LibreOffice Module reportdesign (master) 1
CondFormat.hxx
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 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#ifndef INCLUDED_REPORTDESIGN_SOURCE_UI_INC_CONDFORMAT_HXX
21#define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_CONDFORMAT_HXX
22
23#include <com/sun/star/report/XReportControlModel.hpp>
24#include <vcl/weld.hxx>
25#include <vector>
26
27namespace rptui
28{
29
30
31 constexpr size_t MAX_CONDITIONS = 3;
32
34 class Condition;
35
36
37 //= IConditionalFormatAction
38
40 {
41 public:
42 virtual void addCondition( size_t _nAddAfterIndex ) = 0;
43 virtual void deleteCondition( size_t _nCondIndex ) = 0;
44 virtual void applyCommand( size_t _nCondIndex, sal_uInt16 _nCommandId, const ::Color& rColor ) = 0;
45 virtual void moveConditionUp( size_t _nCondIndex ) = 0;
46 virtual void moveConditionDown( size_t _nCondIndex ) = 0;
47 virtual OUString getDataField() const = 0;
48
49 protected:
51 };
52
53 /*************************************************************************
54 |*
55 |* Conditional formatting dialog
56 |*
57 \************************************************************************/
60 {
61 typedef ::std::vector< std::unique_ptr<Condition> > Conditions;
62
64 css::uno::Reference< css::report::XReportControlModel >
66 css::uno::Reference< css::report::XReportControlModel >
68
70
71 std::unique_ptr<weld::ScrolledWindow> m_xScrollWindow;
72 std::unique_ptr<weld::Box> m_xConditionPlayground;
74
75 public:
77 weld::Window* pParent,
78 const css::uno::Reference< css::report::XReportControlModel>& _xHoldAlive,
79 ::rptui::OReportController& _rController
80 );
81 virtual ~ConditionalFormattingDialog() override;
82 // Dialog overridables
83 virtual short run() override;
84
85 // IConditionalFormatAction overridables
86 virtual void addCondition( size_t _nAddAfterIndex ) override;
87 virtual void deleteCondition( size_t _nCondIndex ) override;
88 virtual void applyCommand( size_t _nCondIndex, sal_uInt16 _nCommandId, const ::Color& rColor ) override;
89 virtual void moveConditionUp( size_t _nCondIndex ) override;
90 virtual void moveConditionDown( size_t _nCondIndex ) override;
91 virtual OUString getDataField() const override;
92
93 private:
95
96 private:
98 size_t impl_getConditionCount() const { return m_aConditions.size(); }
99
104 void impl_addCondition_nothrow( size_t _nNewCondIndex );
105
107 void impl_deleteCondition_nothrow( size_t _nCondIndex );
108
110 void impl_moveCondition_nothrow( size_t _nCondIndex, bool _bMoveUp );
111
113 void impl_layoutAll();
114
117
120
123
125 size_t impl_getFocusedConditionIndex( sal_Int32 _nFallBackIfNone ) const;
126
129
132
134 void impl_focusCondition( size_t _nCondIndex );
135
137 void impl_scrollTo( size_t _nTopCondIndex );
138
140 void impl_ensureConditionVisible( size_t _nCondIndex );
141
143 void impl_setPrefHeight(bool bFirst);
144 };
145
146
147} // namespace rptui
148
149
150#endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_CONDFORMAT_HXX
151
152/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void impl_updateConditionIndicies()
tells all our Condition instances their new index
Definition: CondFormat.cxx:104
virtual void applyCommand(size_t _nCondIndex, sal_uInt16 _nCommandId, const ::Color &rColor) override
Definition: CondFormat.cxx:302
css::uno::Reference< css::report::XReportControlModel > m_xCopy
Definition: CondFormat.hxx:67
void impl_deleteCondition_nothrow(size_t _nCondIndex)
deletes the condition with the given index
Definition: CondFormat.cxx:173
virtual void moveConditionUp(size_t _nCondIndex) override
Definition: CondFormat.cxx:326
size_t impl_getFocusedConditionIndex(sal_Int32 _nFallBackIfNone) const
returns the number of the condition which has the (child path) focus
Definition: CondFormat.cxx:415
virtual void moveConditionDown(size_t _nCondIndex) override
Definition: CondFormat.cxx:334
void impl_layoutAll()
does the dialog layouting
Definition: CondFormat.cxx:271
void impl_setPrefHeight(bool bFirst)
set the preferred height of the action_area
Definition: CondFormat.cxx:56
void impl_conditionCountChanged()
called when the number of conditions has changed in any way
Definition: CondFormat.cxx:115
::std::vector< std::unique_ptr< Condition > > Conditions
Definition: CondFormat.hxx:61
size_t impl_getFirstVisibleConditionIndex() const
returns the index of the first visible condition
Definition: CondFormat.cxx:404
void impl_focusCondition(size_t _nCondIndex)
focuses the condition with the given index, making it visible if necessary
Definition: CondFormat.cxx:164
virtual OUString getDataField() const override
Definition: CondFormat.cxx:341
css::uno::Reference< css::report::XReportControlModel > m_xFormatConditions
Definition: CondFormat.hxx:65
void impl_scrollTo(size_t _nTopCondIndex)
scrolls the condition with the given index to the top position
Definition: CondFormat.cxx:424
virtual void addCondition(size_t _nAddAfterIndex) override
Definition: CondFormat.cxx:126
size_t impl_getLastVisibleConditionIndex() const
returns the index of the last visible condition
Definition: CondFormat.cxx:410
ConditionalFormattingDialog(weld::Window *pParent, const css::uno::Reference< css::report::XReportControlModel > &_xHoldAlive, ::rptui::OReportController &_rController)
Definition: CondFormat.cxx:78
size_t impl_getConditionCount() const
returns the current number of conditions
Definition: CondFormat.hxx:98
void impl_initializeConditions()
initializes the conditions from m_xCopy
Definition: CondFormat.cxx:279
virtual short run() override
Definition: CondFormat.cxx:355
DECL_LINK(OnScroll, weld::ScrolledWindow &, void)
std::unique_ptr< weld::ScrolledWindow > m_xScrollWindow
Definition: CondFormat.hxx:71
::rptui::OReportController & m_rController
Definition: CondFormat.hxx:63
virtual void deleteCondition(size_t _nCondIndex) override
Definition: CondFormat.cxx:133
std::unique_ptr< weld::Box > m_xConditionPlayground
Definition: CondFormat.hxx:72
virtual ~ConditionalFormattingDialog() override
Definition: CondFormat.cxx:100
void impl_moveCondition_nothrow(size_t _nCondIndex, bool _bMoveUp)
moves the condition with the given index one position
Definition: CondFormat.cxx:220
void impl_addCondition_nothrow(size_t _nNewCondIndex)
adds a condition
Definition: CondFormat.cxx:139
void impl_ensureConditionVisible(size_t _nCondIndex)
ensures the condition with the given index is visible
Definition: CondFormat.cxx:434
virtual void moveConditionDown(size_t _nCondIndex)=0
virtual void moveConditionUp(size_t _nCondIndex)=0
virtual void deleteCondition(size_t _nCondIndex)=0
virtual void applyCommand(size_t _nCondIndex, sal_uInt16 _nCommandId, const ::Color &rColor)=0
virtual OUString getDataField() const =0
virtual void addCondition(size_t _nAddAfterIndex)=0
constexpr size_t MAX_CONDITIONS
Definition: CondFormat.hxx:31
#define SAL_NO_VTABLE