LibreOffice Module test (master) 1
xsheetpagebreak.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
9
11
12#include <com/sun/star/sheet/TablePageBreakData.hpp>
13#include <com/sun/star/sheet/XSheetPageBreak.hpp>
14#include <com/sun/star/uno/Reference.hxx>
15#include <com/sun/star/uno/Sequence.hxx>
16
17#include <cppunit/TestAssert.h>
18
19using namespace css;
20using namespace css::uno;
21
22namespace apitest {
23
25{
26 uno::Reference< sheet::XSheetPageBreak > xSheetPageBreak(init(), UNO_QUERY_THROW);
27
28 uno::Sequence< sheet::TablePageBreakData > xColPageBreak = xSheetPageBreak->getColumnPageBreaks();
29 CPPUNIT_ASSERT_MESSAGE("Unable to get column page breaks", xColPageBreak.hasElements());
30}
31
33{
34 uno::Reference< sheet::XSheetPageBreak > xSheetPageBreak(init(), UNO_QUERY_THROW);
35
36 uno::Sequence< sheet::TablePageBreakData > xRowPageBreak = xSheetPageBreak->getRowPageBreaks();
37 CPPUNIT_ASSERT_MESSAGE("Unable to get row page breaks", xRowPageBreak.hasElements());
38}
39
41{
42 uno::Reference< sheet::XSheetPageBreak > xSheetPageBreak(init(), UNO_QUERY_THROW);
43
44 xSheetPageBreak->removeAllManualPageBreaks();
45
46 const uno::Sequence< sheet::TablePageBreakData > xColPageBreak = xSheetPageBreak->getColumnPageBreaks();
47 sal_Int32 manualColPageBreaks = 0;
48 for ( const auto & data : xColPageBreak )
49 {
50 if (data.ManualBreak)
51 manualColPageBreaks++;
52 }
53 CPPUNIT_ASSERT_EQUAL_MESSAGE("Found manual column page break",
54 sal_Int32(0), manualColPageBreaks);
55
56 const uno::Sequence< sheet::TablePageBreakData > xRowPageBreak = xSheetPageBreak->getRowPageBreaks();
57 sal_Int32 manualRowPageBreaks = 0;
58 for ( const auto & data : xRowPageBreak )
59 {
60 if (data.ManualBreak)
61 manualRowPageBreaks++;
62 }
63 CPPUNIT_ASSERT_EQUAL_MESSAGE("Found manual row page break",
64 sal_Int32(0), manualRowPageBreaks);
65}
66
67}
68
69/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual css::uno::Reference< css::uno::XInterface > init()=0