summaryrefslogtreecommitdiff
path: root/reportdesign/source
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2009-01-08 10:47:13 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2009-01-08 10:47:13 +0000
commit0d1d10afd0e490a3fd860e5ffcf18ceeccb58acf (patch)
tree5446a68ff33cc1a638e94d8190d7fda20e67d1cd /reportdesign/source
parent5fd15610fd5fbc6a8373285e35031135d9c1d266 (diff)
CWS-TOOLING: integrate CWS frmdlg
2008-12-18 09:13:09 +0100 oj r265667 : merge from odff05 2008-12-18 07:58:16 +0100 oj r265658 : #i94555# patch from <regina>, ODFF: Add GAMMA, CHISQDIST, CHISQINV. Make the 'cumulative' parameter of GAMMADIST optional. Adapt the domain of CHIDIST to allow negative x. Remove the constraint "degrees of freedom < 1.0E5" from CHIDIST and CHIINV. Plus a mechanism to write the now optional parameter of GAMMADIST to PODF and ODFF if omitted, for backwards compatibility. 2008-12-15 14:06:11 +0100 oj r265490 : CWS-TOOLING: rebase CWS frmdlg to trunk@264807 (milestone: DEV300:m37) 2008-12-15 13:55:28 +0100 oj r265488 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:55:07 +0100 oj r265487 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:54:48 +0100 oj r265486 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:54:36 +0100 oj r265485 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:54:24 +0100 oj r265484 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:48:11 +0100 oj r265483 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:31:12 +0100 oj r265479 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:13:58 +0100 oj r265477 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:10:09 +0100 oj r265476 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:05:11 +0100 oj r265475 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 10:47:17 +0100 oj r265467 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 10:46:19 +0100 oj r265466 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 10:45:47 +0100 oj r265465 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 07:35:07 +0100 oj r265458 : add dependency to formula 2008-12-15 07:34:24 +0100 oj r265457 : add dependency to formula 2008-12-12 13:22:00 +0100 msc r265413 : #i97089# 2008-12-12 13:20:25 +0100 msc r265412 : #i97089# 2008-12-12 12:35:12 +0100 msc r265406 : #i97089# 2008-12-12 12:34:16 +0100 msc r265405 : #i97089# 2008-12-12 12:33:05 +0100 msc r265404 : #i97089# 2008-12-12 12:31:11 +0100 msc r265403 : #i97089# 2008-12-08 11:59:10 +0100 oj r264981 : insert RTL_LOG 2008-12-08 11:50:17 +0100 oj r264980 : some small changes 2008-12-05 12:57:57 +0100 oj r264902 : eof changed 2008-12-05 12:56:46 +0100 oj r264901 : eof changed 2008-12-05 12:28:47 +0100 oj r264899 : wrong var used 2008-12-05 10:08:57 +0100 oj r264890 : token order reversed 2008-12-04 13:49:22 +0100 oc r264843 : #i96688: Adapt autotests because of outsourced functionwizard 2008-12-04 13:45:27 +0100 oc r264842 : #i96688: Adapt autotests because of outsourced functionwizard 2008-12-04 13:42:54 +0100 oc r264841 : #i96688: Adapt autotests because of outsourced functionwizard 2008-12-04 13:37:41 +0100 oc r264840 : #i96688: Adapt autotests because of outsourced functionwizard 2008-12-04 13:34:11 +0100 oc r264839 : #i96688: Adapt autotests because of outsourced functionwizard 2008-12-04 12:35:31 +0100 oj r264835 : new help ids for struct and function tabpage 2008-12-04 12:00:35 +0100 oj r264828 : set explicit help id 2008-12-03 14:53:27 +0100 oj r264786 : #i96845# change ref button 2008-12-03 14:51:49 +0100 oj r264785 : #i96845# change ref button 2008-12-03 08:51:57 +0100 oj r264746 : convert dos to unix lineends 2008-12-03 08:50:45 +0100 oj r264745 : convert dos to unix lineends 2008-12-03 08:50:05 +0100 oj r264744 : convert dos to unix lineends 2008-12-02 12:28:33 +0100 oj r264686 : clear help text when new helpid is set 2008-12-02 12:28:02 +0100 oj r264685 : set help id for listbox category 2008-12-02 07:15:56 +0100 oj r264655 : remove define to auto generate help ids 2008-12-01 14:36:43 +0100 oj r264604 : use temp var 2008-12-01 14:18:31 +0100 oj r264601 : moved ScJumpToken to formula 2008-12-01 14:18:11 +0100 oj r264600 : moved ScJumpToken to formula 2008-12-01 14:14:35 +0100 oj r264599 : moved ScJumpToken from sc 2008-12-01 10:48:51 +0100 oj r264589 : change quickhelptext from Shrink to Select 2008-12-01 10:28:41 +0100 oj r264588 : fix opcode data, has to be Any.Void 2008-11-28 11:16:48 +0100 oj r264532 : add help ids 2008-11-28 10:16:56 +0100 oj r264529 : set help id 2008-11-28 10:16:43 +0100 oj r264528 : set help id 2008-11-26 13:55:04 +0100 oj r264381 : #94535# use of optional instead of deleting a string myself and some small changes 2008-11-26 09:53:20 +0100 oj r264346 : compile error with debug/without debug 2008-11-25 07:41:28 +0100 oj r264271 : put static into the method which make use of them 2008-11-24 08:16:07 +0100 oj r264196 : removed not needed classes for op code 2008-11-24 08:13:44 +0100 oj r264195 : removed not needed classes for op code 2008-11-21 14:05:53 +0100 oj r264135 : make GetOpCode inline 2008-11-21 12:35:27 +0100 oj r264124 : hold symbols 2008-11-20 09:27:27 +0100 oj r264028 : merged code from DEV300_m35 which got lost 2008-11-19 20:42:12 +0100 oj r264022 : more changes for formula dialog remove 2008-11-19 20:37:41 +0100 oj r264021 : removed unused var 2008-11-19 20:35:35 +0100 oj r264020 : some more changes at token 2008-11-19 10:59:47 +0100 oj r263967 : deleted 2008-11-19 10:58:24 +0100 oj r263966 : add forui and for res files 2008-11-18 15:27:36 +0100 oj r263777 : unused para removed 2008-11-18 15:23:23 +0100 oj r263775 : add insert button to add field dlg 2008-11-18 13:39:53 +0100 oj r263764 : enable the formula dialog as well for conditional print as for conditional formatting 2008-11-18 12:03:25 +0100 oj r263760 : rename isRef in IsRef 2008-11-17 11:46:16 +0100 oj r263711 : patches for function handling 2008-11-17 11:36:22 +0100 oj r263710 : add new for forui and res file 2008-11-17 09:21:12 +0100 oj r263704 : patches for some resource for libformula 2008-11-15 12:45:30 +0100 oj r263701 : changes for formula editor extraction 2008-11-07 08:23:27 +0100 oj r263416 : merge from DEV300:m35 2008-11-07 08:22:35 +0100 oj r263415 : merge from DEV300:m35 2008-11-07 08:22:16 +0100 oj r263414 : merge from DEV300:m35 2008-11-07 08:21:41 +0100 oj r263413 : merge from DEV300:m35 2008-11-07 08:21:31 +0100 oj r263412 : merge from DEV300:m35 2008-11-07 08:20:38 +0100 oj r263411 : merge from DEV300:m35 2008-11-07 08:20:00 +0100 oj r263410 : merge from DEV300:m35 2008-11-07 08:18:50 +0100 oj r263409 : merge from DEV300:m35 2008-11-07 08:18:19 +0100 oj r263408 : merge from DEV300:m35 2008-11-07 08:10:27 +0100 oj r263407 : merge from DEV300:m35 2008-10-21 07:43:46 +0200 oj r262560 : some compile errors resolved 2008-10-17 16:40:01 +0200 oj r262291 : dep for 1st target 2008-10-07 10:08:39 +0200 oj r262077 : copy 2008-10-07 09:45:31 +0200 oj r262076 : #i94535# 2008-10-07 09:44:26 +0200 oj r262075 : #i94535# new base class 2008-10-07 09:43:21 +0200 oj r262074 : moved to formula 2008-10-07 09:41:51 +0200 oj r262073 : new images 2008-10-07 09:03:01 +0200 oj r262072 : new ids for formula 2008-10-02 08:46:27 +0200 oj r262024 : #i94535# move the formula compiler to formula 2008-10-02 08:08:54 +0200 oj r262023 : #i94535# 2008-10-02 08:06:28 +0200 oj r262022 : #i94535# 2008-10-02 08:05:52 +0200 oj r262021 : #i94535# 2008-10-01 17:15:29 +0200 oj r262014 : #i94535# 2008-10-01 17:12:40 +0200 oj r262013 : new module formula 2008-10-01 17:04:55 +0200 oj r262012 : #i94535# 2008-10-01 16:49:03 +0200 oj r262010 : #i94535# 2008-10-01 16:46:59 +0200 oj r262009 : #i94535#
Diffstat (limited to 'reportdesign/source')
-rw-r--r--reportdesign/source/ui/dlg/AddField.cxx19
-rw-r--r--reportdesign/source/ui/dlg/Condition.cxx67
-rw-r--r--reportdesign/source/ui/dlg/Condition.hxx20
-rw-r--r--reportdesign/source/ui/dlg/Formula.cxx271
-rw-r--r--reportdesign/source/ui/dlg/makefile.mk3
-rw-r--r--reportdesign/source/ui/inc/AddField.hxx12
-rw-r--r--reportdesign/source/ui/inc/DesignView.hxx33
-rw-r--r--reportdesign/source/ui/inc/Formula.hxx114
-rw-r--r--reportdesign/source/ui/inc/FunctionHelper.hxx115
-rw-r--r--reportdesign/source/ui/inc/ReportController.hxx11
-rw-r--r--reportdesign/source/ui/inc/UITools.hxx14
-rw-r--r--reportdesign/source/ui/inspection/GeometryHandler.cxx258
-rw-r--r--reportdesign/source/ui/misc/FunctionHelper.cxx260
-rw-r--r--reportdesign/source/ui/misc/UITools.cxx64
-rw-r--r--reportdesign/source/ui/misc/makefile.mk3
-rw-r--r--reportdesign/source/ui/report/DesignView.cxx26
-rw-r--r--reportdesign/source/ui/report/ReportController.cxx149
-rw-r--r--reportdesign/source/ui/report/report.src5
18 files changed, 1145 insertions, 299 deletions
diff --git a/reportdesign/source/ui/dlg/AddField.cxx b/reportdesign/source/ui/dlg/AddField.cxx
index bb28d8289e48..4fa7e8d35489 100644
--- a/reportdesign/source/ui/dlg/AddField.cxx
+++ b/reportdesign/source/ui/dlg/AddField.cxx
@@ -33,6 +33,7 @@
#include <svx/dbaexchange.hxx>
#include <svx/svdpagv.hxx>
#include <com/sun/star/sdb/CommandType.hpp>
+#include <com/sun/star/util/URL.hpp>
#include <com/sun/star/sdb/XDocumentDataSource.hpp>
#include <com/sun/star/util/URL.hpp>
#include <com/sun/star/i18n/XCollator.hpp>
@@ -180,6 +181,7 @@ OAddFieldWindow::OAddFieldWindow(Window* pParent
SetMinOutputSizePixel(Size(STD_WIN_SIZE_X,STD_WIN_SIZE_Y));
m_aActions.SetStyle(m_aActions.GetStyle()|WB_LINESPACING);
+ ,m_xRowSet(_xRowSet)
m_aActions.SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetFaceColor()) );
m_aActions.SetSelectHdl(LINK(this, OAddFieldWindow, OnSortAction));
@@ -190,7 +192,12 @@ OAddFieldWindow::OAddFieldWindow(Window* pParent
m_pListBox->SetDoubleClickHdl(LINK( this, OAddFieldWindow, OnDoubleClickHdl ) );
m_pListBox->SetSelectHdl(LINK( this, OAddFieldWindow, OnSelectHdl ) );
m_pListBox->SetDeselectHdl(LINK( this, OAddFieldWindow, OnSelectHdl ) );
+ m_pListBox->SetDoubleClickHdl(LINK( this, OAddFieldWindow, OnDoubleClickHdl ) );
m_pListBox->Show();
+ const String sTitle(ModuleRes(RID_STR_INSERT));
+ m_aInsertButton.SetText(sTitle);
+ m_aInsertButton.SetClickHdl(LINK( this, OAddFieldWindow, OnDoubleClickHdl ) );
+ m_aInsertButton.Show();
SetSizePixel(Size(STD_WIN_SIZE_X,STD_WIN_SIZE_Y));
//Show();
@@ -283,7 +290,7 @@ void OAddFieldWindow::Update()
m_pContainerListener = NULL;
m_xColumns.clear();
- try
+ if ( m_xRowSet.is() )
{
// ListBox loeschen
m_pListBox->Clear();
@@ -339,6 +346,7 @@ void OAddFieldWindow::Update()
{
m_aActions.EnableItem(m_aActions.GetItemId(i));
}
+ }
OnSelectHdl(NULL);
}
}
@@ -501,4 +509,13 @@ IMPL_LINK( OAddFieldWindow, OnSortAction, ToolBox*, /*NOTINTERESTEDIN*/ )
// -----------------------------------------------------------------------------
// =============================================================================
} // namespace rptui
+// -----------------------------------------------------------------------------
+IMPL_LINK( OAddFieldWindow, OnDoubleClickHdl, void* ,/*_pAddFieldDlg*/)
+{
+ if ( m_aCreateLink.IsSet() )
+ m_aCreateLink.Call(this);
+
+ return 0L;
+}
// =============================================================================
+
diff --git a/reportdesign/source/ui/dlg/Condition.cxx b/reportdesign/source/ui/dlg/Condition.cxx
index 62ea6bbde5d6..d23f5946e85c 100644
--- a/reportdesign/source/ui/dlg/Condition.cxx
+++ b/reportdesign/source/ui/dlg/Condition.cxx
@@ -68,6 +68,56 @@ using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
+ConditionField::ConditionField( Condition* _pParent, const ResId& _rResId ) : Edit(_pParent,_rResId)
+,m_pParent(_pParent)
+,m_aFormula(this)
+{
+ m_pSubEdit = new Edit(this,0);
+ SetSubEdit(m_pSubEdit);
+ m_pSubEdit->EnableRTL( FALSE );
+ m_pSubEdit->SetPosPixel( Point() );
+
+ m_aFormula.SetText(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("...")));
+ m_aFormula.SetClickHdl( LINK( this, ConditionField, OnFormula ) );
+ m_aFormula.Show();
+ m_pSubEdit->Show();
+ Resize();
+}
+// -----------------------------------------------------------------------------
+ConditionField::~ConditionField()
+{
+ SetSubEdit(NULL);
+ delete m_pSubEdit;
+}
+// -----------------------------------------------------------------------------
+void ConditionField::Resize()
+{
+ Edit::Resize();
+ const Size aSize = GetOutputSizePixel();
+ const Size aButtonSize( LogicToPixel( Size( 12, 0 ), MAP_APPFONT ).Width(),aSize.Height());
+ const Point aButtonPos(aSize.Width() - aButtonSize.Width(), 0);
+ m_aFormula.SetPosSizePixel(aButtonPos,aButtonSize);
+ m_pSubEdit->SetPosSizePixel(Point(0,0),Size(aButtonPos.X() ,aSize.Height()));
+}
+// -----------------------------------------------------------------------------
+IMPL_LINK( ConditionField, OnFormula, Button*, /*_pClickedButton*/ )
+{
+ ::rtl::OUString sFormula(m_pSubEdit->GetText());
+ const sal_Int32 nLen = sFormula.getLength();
+ if ( nLen )
+ {
+ ReportFormula aFormula( sFormula );
+ sFormula = aFormula.getCompleteFormula();
+ } // if ( nLen )
+ uno::Reference< awt::XWindow> xInspectorWindow = VCLUnoHelper::GetInterface(this);
+ uno::Reference< beans::XPropertySet> xProp(m_pParent->getController().getRowSet(),uno::UNO_QUERY);
+ if ( rptui::openDialogFormula_nothrow( sFormula, m_pParent->getController().getContext(),xInspectorWindow,xProp ) )
+ {
+ ReportFormula aFormula( sFormula );
+ m_pSubEdit->SetText(aFormula.getUndecoratedContent());
+ }
+ return 0L;
+}
//========================================================================
// class SvxColorWindow_Impl --------------------------------------------------
//========================================================================
@@ -509,11 +559,10 @@ void Condition::impl_layoutOperands()
const Rectangle aPreviewRect( m_aPreview.GetPosPixel(), m_aPreview.GetSizePixel() );
// the "condition type" list box
- Rectangle aCondTypeRect( m_aConditionType.GetPosPixel(), m_aConditionType.GetSizePixel() );
- Point aOpListPos( aCondTypeRect.Right() + aRelatedControls.Width(), aCondTypeRect.Top() );
- Size aOpListSize( LogicToPixel( Size( COND_OP_WIDTH, 60 ), MAP_APPFONT ) );
- m_aOperationList.SetPosSizePixel( aOpListPos.X(), aOpListPos.Y(),
- aOpListSize.Width(), aOpListSize.Height() );
+ const Rectangle aCondTypeRect( m_aConditionType.GetPosPixel(), m_aConditionType.GetSizePixel() );
+ const Point aOpListPos( aCondTypeRect.Right() + aRelatedControls.Width(), aCondTypeRect.Top() );
+ const Size aOpListSize( LogicToPixel( Size( COND_OP_WIDTH, 60 ), MAP_APPFONT ) );
+ m_aOperationList.SetPosSizePixel( aOpListPos.X(), aOpListPos.Y(),aOpListSize.Width(), aOpListSize.Height() );
m_aOperationList.Show( !bIsExpression );
// the LHS input field
@@ -528,13 +577,13 @@ void Condition::impl_layoutOperands()
if ( bHaveRHS )
{
// the "and" text being the glue between LHS and RHS
- Point aOpGluePos( aLHSPos.X() + aLHSSize.Width() + aRelatedControls.Width(), aLHSPos.Y() );
- Size aOpGlueSize( m_aOperandGlue.GetTextWidth( m_aOperandGlue.GetText() ) + aRelatedControls.Width(), aLHSSize.Height() );
+ const Point aOpGluePos( aLHSPos.X() + aLHSSize.Width() + aRelatedControls.Width(), aLHSPos.Y() );
+ const Size aOpGlueSize( m_aOperandGlue.GetTextWidth( m_aOperandGlue.GetText() ) + aRelatedControls.Width(), aLHSSize.Height() );
m_aOperandGlue.SetPosSizePixel( aOpGluePos.X(), aOpGluePos.Y(), aOpGlueSize.Width(), aOpGlueSize.Height() );
// the RHS input field
- Point aRHSPos( aOpGluePos.X() + aOpGlueSize.Width() + aRelatedControls.Width(), aOpGluePos.Y() );
- Size aRHSSize( aPreviewRect.Right() - aRHSPos.X(), aLHSSize.Height() );
+ const Point aRHSPos( aOpGluePos.X() + aOpGlueSize.Width() + aRelatedControls.Width(), aOpGluePos.Y() );
+ const Size aRHSSize( aPreviewRect.Right() - aRHSPos.X(), aLHSSize.Height() );
m_aCondRHS.SetPosSizePixel( aRHSPos.X(), aRHSPos.Y(), aRHSSize.Width(), aRHSSize.Height() );
}
diff --git a/reportdesign/source/ui/dlg/Condition.hxx b/reportdesign/source/ui/dlg/Condition.hxx
index 7bcac9cd6fa9..cd5935409efe 100644
--- a/reportdesign/source/ui/dlg/Condition.hxx
+++ b/reportdesign/source/ui/dlg/Condition.hxx
@@ -57,6 +57,20 @@ namespace rptui
class OColorPopup;
class OReportController;
class IConditionalFormatAction;
+ class Condition;
+
+ class ConditionField : public Edit
+ {
+ Condition* m_pParent;
+ Edit* m_pSubEdit;
+ PushButton m_aFormula;
+
+ DECL_LINK( OnFormula, Button* );
+ public:
+ ConditionField( Condition* pParent, const ResId& rResId );
+ virtual ~ConditionField();
+ virtual void Resize();
+ };
//========================================================================
//= Condition
@@ -69,9 +83,9 @@ namespace rptui
FixedLine m_aHeader;
ListBox m_aConditionType;
ListBox m_aOperationList;
- Edit m_aCondLHS;
+ ConditionField m_aCondLHS;
FixedText m_aOperandGlue;
- Edit m_aCondRHS;
+ ConditionField m_aCondRHS;
ToolBox m_aActions;
SvxFontPrevWindow m_aPreview;
ImageButton m_aMoveUp;
@@ -139,6 +153,8 @@ namespace rptui
*/
void ApplyCommand(USHORT _nCommandId, const ::Color& _aColor );
+ inline ::rptui::OReportController& getController() const { return m_rController; }
+
protected:
virtual void StateChanged( StateChangedType nStateChange );
virtual void DataChanged( const DataChangedEvent& rDCEvt );
diff --git a/reportdesign/source/ui/dlg/Formula.cxx b/reportdesign/source/ui/dlg/Formula.cxx
new file mode 100644
index 000000000000..63e8610f9a27
--- /dev/null
+++ b/reportdesign/source/ui/dlg/Formula.cxx
@@ -0,0 +1,271 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: formula.cxx,v $
+ * $Revision: 1.19 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_reportdesign.hxx"
+
+
+//----------------------------------------------------------------------------
+
+#include <vcl/svapp.hxx>
+#include <vcl/mnemonic.hxx>
+#include <vcl/msgbox.hxx>
+#include <unotools/charclass.hxx>
+#include <svtools/viewoptions.hxx>
+#include <tools/urlobj.hxx>
+#include <formula/formdata.hxx>
+#include <formula/funcutl.hxx>
+#include <formula/tokenarray.hxx>
+
+#include "Formula.hxx"
+#include "AddField.hxx"
+#include "helpids.hrc"
+
+//============================================================================
+namespace rptui
+{
+ using namespace formula;
+ using namespace ::com::sun::star;
+
+// --------------------------------------------------------------------------
+// Initialisierung / gemeinsame Funktionen fuer Dialog
+// --------------------------------------------------------------------------
+
+FormulaDialog::FormulaDialog(Window* pParent
+ , const uno::Reference<lang::XMultiServiceFactory>& _xServiceFactory
+ , const ::boost::shared_ptr< IFunctionManager >& _pFunctionMgr
+ , const ::rtl::OUString& _sFormula
+ , const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet >& _xRowSet)
+ : FormulaModalDialog( pParent, false,false,false,this,_pFunctionMgr.get(),this)
+ ,m_aFunctionManager(_pFunctionMgr)
+ ,m_pFormulaData(new FormEditData())
+ ,m_pAddField(NULL)
+ ,m_xRowSet(_xRowSet)
+ ,m_pEdit(NULL)
+ ,m_sFormula(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("=")))
+ ,m_nStart(0)
+ ,m_nEnd(1)
+{
+ if ( _sFormula.getLength() > 0 )
+ {
+ if ( _sFormula.getStr()[0] != '=' )
+ m_sFormula += String(_sFormula);
+ else
+ m_sFormula = _sFormula;
+ }
+ m_xParser.set(_xServiceFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.report.pentaho.SOFormulaParser"))),uno::UNO_QUERY);
+ if ( m_xParser.is() )
+ m_xOpCodeMapper = m_xParser->getFormulaOpCodeMapper();
+ fill();
+}
+
+void FormulaDialog::notifyChange()
+{
+}
+// -----------------------------------------------------------------------------
+void FormulaDialog::fill()
+{
+ SetMeText(m_sFormula);
+ Update(m_sFormula);
+ CheckMatrix(m_sFormula);
+ Update();
+}
+
+FormulaDialog::~FormulaDialog()
+{
+ if ( m_pAddField )
+ {
+ SvtViewOptions aDlgOpt( E_WINDOW, String::CreateFromInt32( HID_RPT_FIELD_SEL_WIN ) );
+ aDlgOpt.SetWindowState( ::rtl::OUString::createFromAscii( m_pAddField->GetWindowState((WINDOWSTATE_MASK_X | WINDOWSTATE_MASK_Y | WINDOWSTATE_MASK_STATE | WINDOWSTATE_MASK_MINIMIZED)).GetBuffer() ) );
+
+ ::std::auto_ptr<Window> aTemp2(m_pAddField);
+ m_pAddField = NULL;
+ }
+}
+
+// --------------------------------------------------------------------------
+// Funktionen fuer rechte Seite
+// --------------------------------------------------------------------------
+bool FormulaDialog::calculateValue( const String& rStrExp, String& rStrResult )
+{
+ rStrResult = rStrExp;
+ return false;
+}
+void FormulaDialog::doClose(BOOL _bOk)
+{
+ EndDialog(_bOk ? RET_OK : RET_CANCEL);
+}
+void FormulaDialog::insertEntryToLRUList(const IFunctionDescription* /*_pDesc*/)
+{
+}
+void FormulaDialog::showReference(const String& /*_sFormula*/)
+{
+}
+void FormulaDialog::dispatch(BOOL /*_bOK*/,BOOL /*_bMartixChecked*/)
+{
+}
+void FormulaDialog::setDispatcherLock( BOOL /*bLock*/ )
+{
+}
+void FormulaDialog::setReferenceInput(const FormEditData* /*_pData*/)
+{
+}
+void FormulaDialog::deleteFormData()
+{
+}
+void FormulaDialog::clear()
+{
+}
+void FormulaDialog::switchBack()
+{
+}
+FormEditData* FormulaDialog::getFormEditData() const
+{
+ return m_pFormulaData;
+}
+void FormulaDialog::setCurrentFormula(const String& _sReplacement)
+{
+ const xub_StrLen nOldLen = m_nEnd - m_nStart;
+ const xub_StrLen nNewLen = _sReplacement.Len();
+ if (nOldLen)
+ m_sFormula.Erase( m_nStart, nOldLen );
+ if (nNewLen)
+ m_sFormula.Insert( _sReplacement, m_nStart );
+ m_nEnd = m_nStart + nNewLen;
+}
+void FormulaDialog::setSelection(xub_StrLen _nStart,xub_StrLen _nEnd)
+{
+ if ( _nStart <= _nEnd )
+ {
+ m_nStart = _nStart;
+ m_nEnd = _nEnd;
+ }
+ else
+ {
+ m_nEnd = _nStart;
+ m_nStart = _nEnd;
+ }
+}
+void FormulaDialog::getSelection(xub_StrLen& _nStart,xub_StrLen& _nEnd) const
+{
+ _nStart = m_nStart;
+ _nEnd = m_nEnd;
+}
+String FormulaDialog::getCurrentFormula() const
+{
+ return m_sFormula;
+}
+IFunctionManager* FormulaDialog::getFunctionManager()
+{
+ return m_aFunctionManager.get();
+}
+// -----------------------------------------------------------------------------
+void FormulaDialog::ShowReference(const String& /*_sRef*/)
+{
+}
+// -----------------------------------------------------------------------------
+void FormulaDialog::HideReference( BOOL /*bDoneRefMode*/)
+{
+}
+// -----------------------------------------------------------------------------
+void FormulaDialog::ReleaseFocus( RefEdit* /*pEdit*/, RefButton* /*pButton*/)
+{
+}
+// -----------------------------------------------------------------------------
+void FormulaDialog::ToggleCollapsed( RefEdit* _pEdit, RefButton* _pButton)
+{
+ ::std::pair<RefButton*,RefEdit*> aPair = RefInputStartBefore( _pEdit, _pButton );
+ m_pEdit = aPair.second;
+ if ( m_pEdit )
+ m_pEdit->Hide();
+ if ( aPair.first )
+ aPair.first->Hide();
+
+ if ( !m_pAddField )
+ {
+ m_pAddField = new OAddFieldWindow(this,m_xRowSet);
+ m_pAddField->SetCreateHdl(LINK( this, FormulaDialog, OnClickHdl ) );
+ SvtViewOptions aDlgOpt( E_WINDOW, String::CreateFromInt32( HID_RPT_FIELD_SEL_WIN ) );
+ if ( aDlgOpt.Exists() )
+ {
+ m_pAddField->SetWindowState( ByteString( aDlgOpt.GetWindowState().getStr(), RTL_TEXTENCODING_ASCII_US ) );
+
+ }
+
+ m_pAddField->Update();
+ } // if ( !m_pAddField )
+ RefInputStartAfter( aPair.second, aPair.first );
+ m_pAddField->Show();
+
+}
+// -----------------------------------------------------------------------------
+IMPL_LINK( FormulaDialog, OnClickHdl, OAddFieldWindow* ,_pAddFieldDlg)
+{
+ const uno::Sequence< beans::PropertyValue > aArgs = _pAddFieldDlg->getSelectedFieldDescriptors();
+ // we use this way to create undo actions
+ if ( m_pEdit && aArgs.getLength() == 1)
+ {
+ uno::Sequence< beans::PropertyValue > aValue;
+ aArgs[0].Value >>= aValue;
+ ::svx::ODataAccessDescriptor aDescriptor(aValue);
+ ::rtl::OUString sName;
+ aDescriptor[ ::svx::daColumnName ] >>= sName;
+ if ( sName.getLength() )
+ {
+ sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("[")) + sName + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("]"));
+ m_pEdit->SetText(sName);
+ }
+ } // if ( m_pEdit && aArgs.getLength() )
+ m_pEdit = NULL;
+ _pAddFieldDlg->Hide();
+ RefInputDoneAfter( TRUE );
+
+ return 0L;
+}
+// -----------------------------------------------------------------------------
+uno::Reference< sheet::XFormulaParser> FormulaDialog::getFormulaParser() const
+{
+ return m_xParser.get();
+}
+// -----------------------------------------------------------------------------
+uno::Reference< sheet::XFormulaOpCodeMapper> FormulaDialog::getFormulaOpCodeMapper() const
+{
+ return m_xOpCodeMapper;
+}
+// -----------------------------------------------------------------------------
+::std::auto_ptr<formula::FormulaTokenArray> FormulaDialog::convertToTokenArray(const uno::Sequence< sheet::FormulaToken >& _aTokenList)
+{
+ ::std::auto_ptr<formula::FormulaTokenArray> pArray(new FormulaTokenArray());
+ pArray->Fill(_aTokenList);
+ return pArray;
+}
+// =============================================================================
+} // rptui
+// =============================================================================
diff --git a/reportdesign/source/ui/dlg/makefile.mk b/reportdesign/source/ui/dlg/makefile.mk
index 8f0244a0aef1..431886747407 100644
--- a/reportdesign/source/ui/dlg/makefile.mk
+++ b/reportdesign/source/ui/dlg/makefile.mk
@@ -64,7 +64,8 @@ EXCEPTIONSFILES= \
$(SLO)$/DateTime.obj \
$(SLO)$/AddField.obj \
$(SLO)$/Navigator.obj \
- $(SLO)$/GroupsSorting.obj
+ $(SLO)$/GroupsSorting.obj \
+ $(SLO)$/Formula.obj
SLOFILES= \
$(EXCEPTIONSFILES) \
diff --git a/reportdesign/source/ui/inc/AddField.hxx b/reportdesign/source/ui/inc/AddField.hxx
index eb3535ac560f..f5878b918edf 100644
--- a/reportdesign/source/ui/inc/AddField.hxx
+++ b/reportdesign/source/ui/inc/AddField.hxx
@@ -34,11 +34,16 @@
#include <com/sun/star/frame/XDispatch.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/sdbc/XConnection.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <svtools/transfer.hxx>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
#include <svtools/svtreebx.hxx>
#include <svtools/transfer.hxx>
#include <vcl/floatwin.hxx>
#include <comphelper/propmultiplex.hxx>
-#include <comphelper/containermultiplexer.hxx>
+#include <vcl/button.hxx>
+
#include <svx/dataaccessdescriptor.hxx>
#include "cppuhelper/basemutex.hxx"
#include <dbaccess/ToolBoxHelper.hxx>
@@ -63,8 +68,11 @@ class OAddFieldWindow :public FloatingWindow
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xRowSet;
ToolBox m_aActions;
+ DECL_LINK( OnDoubleClickHdl, void* );
+
::std::auto_ptr<OAddFieldWindowListBox> m_pListBox;
+ PushButton m_aInsertButton;
Link m_aCreateLink;
::rtl::OUString m_aCommandName;
::rtl::OUString m_sFilter;
@@ -91,6 +99,8 @@ public:
inline const ::rtl::OUString& GetCommand() const { return m_aCommandName; }
inline sal_Int32 GetCommandType() const { return m_nCommandType; }
inline sal_Bool GetEscapeProcessing() const { return m_bEscapeProcessing; }
+ inline void SetCreateHdl(const Link& _aCreateLink) { m_aCreateLink = _aCreateLink; }
+
inline ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> getColumns() const { return m_xColumns; }
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getConnection() const;
diff --git a/reportdesign/source/ui/inc/DesignView.hxx b/reportdesign/source/ui/inc/DesignView.hxx
index 47d75744ee1b..a5df57daf0c6 100644
--- a/reportdesign/source/ui/inc/DesignView.hxx
+++ b/reportdesign/source/ui/inc/DesignView.hxx
@@ -34,28 +34,23 @@
#include <com/sun/star/frame/XController.hpp>
#include <com/sun/star/report/XSection.hpp>
#include <com/sun/star/report/XReportComponent.hpp>
+#include <vcl/split.hxx>
+#include <vcl/scrbar.hxx>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/datatransfer/DataFlavor.hpp>
#include <tools/link.hxx>
#include <tools/gen.hxx>
-
#include <vcl/timer.hxx>
-#include <vcl/tabpage.hxx>
-#include <vcl/splitwin.hxx>
-#include <vcl/split.hxx>
-#include <vcl/scrbar.hxx>
-
#include <svtools/hint.hxx>
#include <svtools/brdcst.hxx>
+#include <comphelper/stl_types.hxx>
+#include "ReportDefines.hxx"
#include <svtools/colorcfg.hxx>
#include <boost/shared_ptr.hpp>
#include <svx/svdedtv.hxx>
-#include <svx/zoomitem.hxx>
-
-#include <comphelper/stl_types.hxx>
-
-#include "ReportDefines.hxx"
-#include "MarkedSection.hxx"
+#include <vcl/tabpage.hxx>
+#include <vcl/splitwin.hxx>
+#include <MarkedSection.hxx>
#include "ScrollHelper.hxx"
class KeyEvent;
@@ -94,8 +89,7 @@ namespace rptui
USHORT m_nCurrentPosition;
USHORT m_eActObj;
BOOL m_bFirstDraw;
- Size m_aGridSizeCoarse;
- Size m_aGridSizeFine;
+ Size m_aGridSize;
BOOL m_bGridVisible;
BOOL m_bGridSnap;
BOOL m_bDeleted;
@@ -194,9 +188,7 @@ namespace rptui
,const ::rtl::OUString& _sColorEntry
,USHORT _nPosition = USHRT_MAX);
- inline Size getGridSizeCoarse() const { return m_aGridSizeCoarse; }
- inline Size getGridSizeFine() const { return m_aGridSizeFine; }
-
+ inline Size getGridSize() const { return m_aGridSize; }
inline BOOL isGridSnap() const { return m_bGridSnap; }
void setGridSnap(BOOL bOn);
void setDragStripes(BOOL bOn);
@@ -281,17 +273,16 @@ namespace rptui
/** zoom the ruler and view windows
*/
- void zoom(const Fraction& _aZoom);
+ void zoom(const sal_Int16 _nZoom);
/** fills the vector with all selected control models
/param _rSelection The vector will be filled and will not be cleared before.
*/
void fillControlModelSelection(::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > >& _rSelection) const;
- /** calculates the zoom factor.
- @param _eType which kind of zoom is needed
+ /** returns the selected field from the add field dialog
*/
- sal_uInt16 getZoomFactor(SvxZoomType _eType) const;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > getSelectedFieldDescriptors();
};
//==================================================================
} //rptui
diff --git a/reportdesign/source/ui/inc/Formula.hxx b/reportdesign/source/ui/inc/Formula.hxx
new file mode 100644
index 000000000000..a3a9f35d3ac0
--- /dev/null
+++ b/reportdesign/source/ui/inc/Formula.hxx
@@ -0,0 +1,114 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: formula.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef RPTUI_FORMULA_HXX
+#define RPTUI_FORMULA_HXX
+
+#include <formula/formula.hxx>
+#include <formula/IFunctionDescription.hxx>
+#include <formula/IControlReferenceHandler.hxx>
+#include <boost/shared_ptr.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/report/meta/XFormulaParser.hpp>
+
+class SvLBoxEntry;
+//============================================================================
+namespace rptui
+{
+//============================================================================
+class FunctionManager;
+class OAddFieldWindow;
+
+//============================================================================
+class FormulaDialog : public formula::FormulaModalDialog,
+ public formula::IFormulaEditorHelper,
+ public formula::IControlReferenceHandler
+{
+ ::boost::shared_ptr< formula::IFunctionManager > m_aFunctionManager;
+ formula::FormEditData* m_pFormulaData;
+ OAddFieldWindow* m_pAddField;
+ ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > m_xRowSet;
+ ::com::sun::star::uno::Reference< ::com::sun::star::report::meta::XFormulaParser> m_xParser;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaOpCodeMapper> m_xOpCodeMapper;
+ formula::RefEdit* m_pEdit;
+ String m_sFormula;
+ xub_StrLen m_nStart;
+ xub_StrLen m_nEnd;
+
+ DECL_LINK( OnClickHdl, OAddFieldWindow*);
+public:
+ FormulaDialog( Window* pParent
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _xServiceFactory
+ , const ::boost::shared_ptr< formula::IFunctionManager >& _pFunctionMgr
+ , const ::rtl::OUString& _sFormula
+ , const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet >& _xRowSet);
+ virtual ~FormulaDialog();
+
+ // IFormulaEditorHelper
+ virtual void notifyChange();
+ virtual void fill();
+ virtual bool calculateValue(const String& _sExpression,String& _rResult);
+ virtual void doClose(BOOL _bOk);
+ virtual void insertEntryToLRUList(const formula::IFunctionDescription* pDesc);
+ virtual void showReference(const String& _sFormula);
+ virtual void dispatch(BOOL _bOK,BOOL _bMartixChecked);
+ virtual void setDispatcherLock( BOOL bLock );
+ virtual void setReferenceInput(const formula::FormEditData* _pData);
+ virtual void deleteFormData();
+ virtual void clear();
+ virtual void switchBack();
+ virtual formula::FormEditData* getFormEditData() const;
+ virtual void setCurrentFormula(const String& _sReplacement);
+ virtual void setSelection(xub_StrLen _nStart,xub_StrLen _nEnd);
+ virtual void getSelection(xub_StrLen& _nStart,xub_StrLen& _nEnd) const;
+ virtual String getCurrentFormula() const;
+
+ virtual formula::IFunctionManager* getFunctionManager();
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaParser> getFormulaParser() const;
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaOpCodeMapper> getFormulaOpCodeMapper() const;
+
+ virtual ::std::auto_ptr<formula::FormulaTokenArray> convertToTokenArray(const ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken >& _aTokenList);
+
+ // IControlReferenceHandler
+ virtual void ShowReference(const String& _sRef);
+ virtual void HideReference( BOOL bDoneRefMode = TRUE );
+ virtual void ReleaseFocus( formula::RefEdit* pEdit, formula::RefButton* pButton = NULL );
+ virtual void ToggleCollapsed( formula::RefEdit* pEdit, formula::RefButton* pButton = NULL );
+
+protected:
+ void HighlightFunctionParas(const String& aFormula);
+};
+
+// =============================================================================
+} // rptui
+// =============================================================================
+
+#endif // RPTUI_FORMULA_HXX
+
diff --git a/reportdesign/source/ui/inc/FunctionHelper.hxx b/reportdesign/source/ui/inc/FunctionHelper.hxx
new file mode 100644
index 000000000000..735a70083192
--- /dev/null
+++ b/reportdesign/source/ui/inc/FunctionHelper.hxx
@@ -0,0 +1,115 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: formula.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef RPTUI_FUNCTIONHELPER_HXX
+#define RPTUI_FUNCTIONHELPER_HXX
+
+#include <formula/IFunctionDescription.hxx>
+#include <com/sun/star/report/meta/XFunctionManager.hpp>
+#include <com/sun/star/report/meta/XFunctionCategory.hpp>
+#include <com/sun/star/report/meta/XFunctionDescription.hpp>
+#include <vector>
+#include <boost/shared_ptr.hpp>
+#include <tools/string.hxx>
+#include <comphelper/stl_types.hxx>
+
+
+namespace rptui
+{
+//============================================================================
+class FunctionCategory;
+class FunctionDescription;
+//============================================================================
+class FunctionManager : public formula::IFunctionManager
+{
+ DECLARE_STL_USTRINGACCESS_MAP( ::boost::shared_ptr< FunctionDescription >, TFunctionsMap);
+ DECLARE_STL_USTRINGACCESS_MAP( ::boost::shared_ptr< FunctionCategory > , TCategoriesMap);
+ ::com::sun::star::uno::Reference< ::com::sun::star::report::meta::XFunctionManager> m_xMgr;
+ mutable TCategoriesMap m_aCategories;
+ mutable ::std::vector< TCategoriesMap::iterator > m_aCategoryIndex;
+ mutable TFunctionsMap m_aFunctions;
+public:
+ FunctionManager(const ::com::sun::star::uno::Reference< ::com::sun::star::report::meta::XFunctionManager>& _xMgr);
+ virtual ~FunctionManager();
+ virtual sal_uInt32 getCount() const;
+ virtual const formula::IFunctionCategory* getCategory(sal_uInt32 nPos) const;
+ virtual void fillLastRecentlyUsedFunctions(::std::vector< const formula::IFunctionDescription*>& _rLastRUFunctions) const;
+ virtual const formula::IFunctionDescription* getFunctionByName(const ::rtl::OUString& _sFunctionName) const;
+ virtual const sal_Unicode getSingleToken(const EToken _eToken) const;
+
+ ::boost::shared_ptr< FunctionDescription > get(const ::com::sun::star::uno::Reference< ::com::sun::star::report::meta::XFunctionDescription>& _xFunctionDescription) const;
+};
+//============================================================================
+class FunctionDescription : public formula::IFunctionDescription
+{
+ ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FunctionArgument > m_aParameter;
+ ::com::sun::star::uno::Reference< ::com::sun::star::report::meta::XFunctionDescription> m_xFunctionDescription;
+ const formula::IFunctionCategory* m_pFunctionCategory;
+public:
+ FunctionDescription(const formula::IFunctionCategory* _pFunctionCategory,const ::com::sun::star::uno::Reference< ::com::sun::star::report::meta::XFunctionDescription>& _xFunctionDescription);
+ virtual ~FunctionDescription(){}
+
+ virtual ::rtl::OUString getFunctionName() const ;
+ virtual const formula::IFunctionCategory* getCategory() const ;
+ virtual ::rtl::OUString getDescription() const ;
+ virtual xub_StrLen getSuppressedArgumentCount() const ;
+ virtual ::rtl::OUString getFormula(const ::std::vector< ::rtl::OUString >& _aArguments) const ;
+ virtual void fillVisibleArgumentMapping(::std::vector<USHORT>& _rArguments) const ;
+ virtual void initArgumentInfo() const;
+ virtual ::rtl::OUString getSignature() const ;
+ virtual long getHelpId() const ;
+ virtual sal_uInt32 getParameterCount() const ;
+ virtual ::rtl::OUString getParameterName(sal_uInt32 _nPos) const ;
+ virtual ::rtl::OUString getParameterDescription(sal_uInt32 _nPos) const ;
+ virtual bool isParameterOptional(sal_uInt32 _nPos) const ;
+};
+//============================================================================
+class FunctionCategory : public formula::IFunctionCategory
+{
+ mutable ::std::vector< ::boost::shared_ptr< FunctionDescription > > m_aFunctions;
+ ::com::sun::star::uno::Reference< ::com::sun::star::report::meta::XFunctionCategory> m_xCategory;
+ sal_uInt32 m_nFunctionCount;
+ sal_uInt32 m_nNumber;
+ const FunctionManager* m_pFunctionManager;
+public:
+ FunctionCategory(const FunctionManager* _pFMgr,sal_uInt32 _nPos,const ::com::sun::star::uno::Reference< ::com::sun::star::report::meta::XFunctionCategory>& _xCategory);
+ virtual ~FunctionCategory() {}
+
+ virtual sal_uInt32 getCount() const;
+ virtual const formula::IFunctionDescription* getFunction(sal_uInt32 _nPos) const;
+ virtual sal_uInt32 getNumber() const;
+ virtual const formula::IFunctionManager* getFunctionManager() const;
+ virtual ::rtl::OUString getName() const;
+};
+// =============================================================================
+} // rptui
+// =============================================================================
+
+#endif //RPTUI_FUNCTIONHELPER_HXX
diff --git a/reportdesign/source/ui/inc/ReportController.hxx b/reportdesign/source/ui/inc/ReportController.hxx
index 887ae576a035..cd19132f8322 100644
--- a/reportdesign/source/ui/inc/ReportController.hxx
+++ b/reportdesign/source/ui/inc/ReportController.hxx
@@ -53,7 +53,6 @@
#include <svtools/transfer.hxx>
#include <svtools/lstner.hxx>
#include <svx/svdedtv.hxx>
-#include <svx/zoomitem.hxx>
#include "ModuleHelper.hxx"
#include <comphelper/uno3.hxx>
@@ -119,8 +118,8 @@ namespace rptui
sal_Int32 m_nSplitPos; /// the position of the splitter
sal_Int32 m_nPageNum; /// the page number from the restoreView call
sal_Int32 m_nSelectionCount;
+ //sal_Int32 m_nExecuteReportEvent;
sal_Int16 m_nZoomValue;
- SvxZoomType m_eZoomType;
sal_Bool m_bShowRuler;
sal_Bool m_bGridVisible;
sal_Bool m_bGridUse;
@@ -178,10 +177,6 @@ namespace rptui
*/
void openSortingAndGroupingDialog();
- /** opens the zoom dialog
- */
- void openZoomDialog();
-
/** returns the position of the group inside the groups collection
*/
sal_Int32 getGroupPosition(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup >& _xGroup);
@@ -299,6 +294,7 @@ namespace rptui
DECL_LINK( OnClipboardChanged, void* );
DECL_LINK( OnExecuteReport, void* );
DECL_LINK( OnOpenHelpAgent, void* );
+
short saveModified();
// all the features which should be handled by this class
virtual void describeSupportedFeatures();
@@ -426,8 +422,7 @@ namespace rptui
::boost::shared_ptr<rptui::OReportModel> getSdrModel();
inline ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > getContext() const { return m_xContext; }
- inline sal_Int16 getZoomValue() const { return m_nZoomValue; }
- inline void resetZoomType() { m_eZoomType = SVX_ZOOM_PERCENT; }
+ inline sal_Int16 getZoomValue() const { return m_nZoomValue; }
// com::sun::star::beans::XPropertySet
virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
diff --git a/reportdesign/source/ui/inc/UITools.hxx b/reportdesign/source/ui/inc/UITools.hxx
index 28b42b65402b..d277a1abfd63 100644
--- a/reportdesign/source/ui/inc/UITools.hxx
+++ b/reportdesign/source/ui/inc/UITools.hxx
@@ -104,6 +104,20 @@ namespace rptui
,const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>& _xWindow
);
+ /** opens the formula dialog
+ @param _out_rFormula
+ the formula chosen by the user
+ @precond
+ we're really inspecting a database report (well, a RowSet at least)
+ @return
+ <TRUE/> if and only if the user successfully chose a clause
+ */
+ bool openDialogFormula_nothrow( ::rtl::OUString& _in_out_rFormula
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _xContext
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>& _xWindow
+ , const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet >& _xRowSet
+ );
+
/** applies the character settings previously obtained via openCharDialog
*/
void applyCharacterSettings(
diff --git a/reportdesign/source/ui/inspection/GeometryHandler.cxx b/reportdesign/source/ui/inspection/GeometryHandler.cxx
index 5ff344d4838f..c497b5ade62d 100644
--- a/reportdesign/source/ui/inspection/GeometryHandler.cxx
+++ b/reportdesign/source/ui/inspection/GeometryHandler.cxx
@@ -46,7 +46,6 @@
#include <tools/diagnose_ex.h>
#include <tools/StringListResource.hxx>
#include <com/sun/star/lang/XInitialization.hpp>
-#include <com/sun/star/drawing/FillStyle.hpp>
#include "com/sun/star/inspection/StringRepresentation.hpp"
#include <com/sun/star/inspection/PropertyLineElement.hpp>
#include <com/sun/star/inspection/PropertyControlType.hpp>
@@ -76,11 +75,11 @@
#include "RptResId.hrc"
#include "RptDef.hxx"
#include "UITools.hxx"
+
#include <connectivity/dbexception.hxx>
#include <connectivity/dbconversion.hxx>
#include <connectivity/dbtools.hxx>
-
#include <boost/bind.hpp>
#include <tools/string.hxx>
#include "metadata.hxx"
@@ -129,7 +128,7 @@ namespace rptui
{
//........................................................................
using namespace ::com::sun::star;
-// using namespace comphelper;
+//using namespace formula;
// comparing two property instances
struct PropertyCompare : public ::std::binary_function< beans::Property, ::rtl::OUString , bool >
@@ -447,43 +446,6 @@ uno::Any SAL_CALL GeometryHandler::getPropertyValue(const ::rtl::OUString & Prop
aPropertyValue.clear();
}
break;
- case PROPERTY_ID_AREA:
- {
- drawing::FillStyle aFillStyle;
- m_xReportComponent->getPropertyValue(PROPERTY_FILLSTYLE) >>= aFillStyle;
- ::rtl::OUString sProperty;
- switch(aFillStyle)
- {
- case drawing::FillStyle_GRADIENT:
- sProperty = PROPERTY_FILLGRADIENTNAME;
- break;
- case drawing::FillStyle_HATCH:
- sProperty = PROPERTY_FILLHATCHNAME;
- break;
- case drawing::FillStyle_BITMAP:
- sProperty = PROPERTY_FILLBITMAPNAME;
- break;
- case drawing::FillStyle_NONE:
- {
- const ::rtl::OUString sNone = String( ModuleRes( RID_STR_NONE ) );
- aPropertyValue <<= sNone;
- break;
- }
- default:
- break;
- }
-
- if ( sProperty.getLength() )
- {
- aPropertyValue = m_xReportComponent->getPropertyValue(sProperty);
- //if ( drawing::FillStyle_GRADIENT == aFillStyle )
- //{
- // static const ::rtl::OUString s_sFillTransparenceGradientName(RTL_CONSTASCII_USTRINGPARAM("FillTransparenceGradientName"));
- // aPropertyValue = m_xReportComponent->getPropertyValue(s_sFillTransparenceGradientName);
- //}
- }
- }
- break;
case PROPERTY_ID_MIMETYPE:
{
::rtl::OUString sValue;
@@ -816,7 +778,13 @@ inspection::LineDescriptor SAL_CALL GeometryHandler::describePropertyLine(const
break;
case PROPERTY_ID_INITIALFORMULA:
case PROPERTY_ID_FORMULA:
+ aOut.PrimaryButtonId = UID_RPT_PROP_FORMULA;
+ aOut.HasPrimaryButton = sal_True;
+ aOut.Control = _xControlFactory->createPropertyControl(inspection::PropertyControlType::MultiLineTextField , sal_False);
+ break;
case PROPERTY_ID_CONDITIONALPRINTEXPRESSION:
+ aOut.PrimaryButtonId = UID_RPT_PROP_FORMULA;
+ aOut.HasPrimaryButton = sal_True;
aOut.Control = _xControlFactory->createPropertyControl(inspection::PropertyControlType::MultiLineTextField , sal_False);
break;
case PROPERTY_ID_DATAFIELD:
@@ -828,6 +796,12 @@ inspection::LineDescriptor SAL_CALL GeometryHandler::describePropertyLine(const
uno::UNO_QUERY_THROW
);
+ if ( m_nDataFieldType == DATA_OR_FORMULA )
+ {
+ aOut.PrimaryButtonId = UID_RPT_PROP_FORMULA;
+ aOut.HasPrimaryButton = sal_True;
+ }
+
aOut.Control = xListControl.get();
if ( m_nDataFieldType == USER_DEF_FUNCTION )
{
@@ -1080,10 +1054,8 @@ uno::Any SAL_CALL GeometryHandler::convertToPropertyValue(const ::rtl::OUString
return m_xFormComponentHandler->convertToPropertyValue(PROPERTY_FONTNAME, _rControlValue);
case PROPERTY_ID_SCOPE:
case PROPERTY_ID_FORMULALIST:
- aPropertyValue = _rControlValue;
- break;
case PROPERTY_ID_AREA:
- //aPropertyValue = _rControlValue;
+ aPropertyValue = _rControlValue;
break;
case PROPERTY_ID_TYPE:
{
@@ -1309,12 +1281,13 @@ uno::Sequence< beans::Property > SAL_CALL GeometryHandler::getSupportedPropertie
} // for (size_t i = 0; i < sizeof(pIncludeProperties)/sizeof(pIncludeProperties[0]) ;++i )
// special property for shapes
- if ( uno::Reference< report::XShape>(m_xReportComponent,uno::UNO_QUERY).is() )
- {
- beans::Property aValue;
- aValue.Name = PROPERTY_AREA;
- aNewProps.push_back(aValue);
- }
+// if ( uno::Reference< report::XShape>(m_xReportComponent,uno::UNO_QUERY).is() )
+// {
+// beans::Property aValue;
+// aValue.Name = PROPERTY_AREA;
+// aNewProps.push_back(aValue);
+// }
+ // re-enable when the remaining issues of #i88727# are fixed
return uno::Sequence< beans::Property > (&(*aNewProps.begin()),aNewProps.size());
}
@@ -1340,14 +1313,12 @@ uno::Sequence< ::rtl::OUString > SAL_CALL GeometryHandler::getActuatingPropertie
{
::osl::MutexGuard aGuard( m_aMutex );
- uno::Sequence< ::rtl::OUString > aSeq(7);
+ uno::Sequence< ::rtl::OUString > aSeq(5);
aSeq[0] = PROPERTY_BACKTRANSPARENT;
aSeq[1] = PROPERTY_CONTROLBACKGROUNDTRANSPARENT;
aSeq[2] = PROPERTY_FORMULALIST;
aSeq[3] = PROPERTY_TYPE;
aSeq[4] = PROPERTY_DATAFIELD;
- aSeq[5] = PROPERTY_FILLSTYLE;
- aSeq[6] = PROPERTY_FILLCOLOR;
return ::comphelper::concatSequences(m_xFormComponentHandler->getActuatingProperties(),aSeq);
}
@@ -1391,6 +1362,29 @@ inspection::InteractiveSelectionResult SAL_CALL GeometryHandler::onInteractivePr
}
return eResult;
}
+ else if ( PropertyName.equalsAscii(PROPERTY_FORMULA)
+ || PropertyName.equalsAscii(PROPERTY_INITIALFORMULA)
+ || PropertyName.equalsAscii(PROPERTY_DATAFIELD)
+ || PropertyName.equalsAscii(PROPERTY_CONDITIONALPRINTEXPRESSION))
+ {
+ ::osl::ClearableMutexGuard aGuard( m_aMutex );
+
+
+ ::rtl::OUString sFormula;
+ m_xReportComponent->getPropertyValue(PropertyName) >>= sFormula;
+ const uno::Reference< awt::XWindow> xInspectorWindow(m_xContext->getValueByName( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DialogParentWindow"))) ,uno::UNO_QUERY);
+ uno::Reference< uno::XComponentContext > xContext = m_xContext;
+ uno::Reference< beans::XPropertySet > xRowSet( m_xRowSet,uno::UNO_QUERY);
+ aGuard.clear();
+
+ inspection::InteractiveSelectionResult eResult = inspection::InteractiveSelectionResult_Cancelled;
+ if ( rptui::openDialogFormula_nothrow( sFormula, xContext,xInspectorWindow,xRowSet ) )
+ {
+ _rData <<= sFormula;
+ eResult = inspection::InteractiveSelectionResult_ObtainedValue;
+ }
+ return eResult;
+ }
else if ( PropertyName.equalsAscii(PROPERTY_AREA) )
{
::osl::ClearableMutexGuard aGuard( m_aMutex );
@@ -1398,15 +1392,15 @@ inspection::InteractiveSelectionResult SAL_CALL GeometryHandler::onInteractivePr
inspection::InteractiveSelectionResult eResult = inspection::InteractiveSelectionResult_Cancelled;
const uno::Reference< awt::XWindow> xInspectorWindow(m_xContext->getValueByName( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DialogParentWindow"))) ,uno::UNO_QUERY);
const uno::Reference< report::XShape> xShape(m_xReportComponent,uno::UNO_QUERY);
-
aGuard.clear();
if ( rptui::openAreaDialog( xShape, xInspectorWindow) )
{
eResult = inspection::InteractiveSelectionResult_ObtainedValue;
beans::PropertyChangeEvent aScopeEvent;
- aScopeEvent.PropertyName = PROPERTY_FILLSTYLE;
- aScopeEvent.NewValue = xShape->getPropertyValue(PROPERTY_FILLSTYLE);
+ aScopeEvent.PropertyName = PROPERTY_FILLCOLOR;
+ // aScopeEvent.OldValue <<= _nOldDataFieldType;
+ aScopeEvent.NewValue <<= xShape->getPropertyValue(PROPERTY_FILLCOLOR);
m_aPropertyListeners.notify( aScopeEvent, &beans::XPropertyChangeListener::propertyChange );
}
return eResult;
@@ -1422,102 +1416,79 @@ void SAL_CALL GeometryHandler::actuatingPropertyChanged(const ::rtl::OUString &
throw lang::NullPointerException();
::osl::MutexGuard aGuard( m_aMutex );
- if ( ActuatingPropertyName == PROPERTY_FILLSTYLE )
- {
- drawing::FillStyle aFillStyle;
- NewValue >>= aFillStyle;
- const sal_Bool bEnable = aFillStyle == drawing::FillStyle_SOLID;
- _rxInspectorUI->enablePropertyUI(PROPERTY_FILLCOLOR,bEnable);
- if ( bEnable )
- _rxInspectorUI->rebuildPropertyUI(PROPERTY_FILLCOLOR);
-
- _rxInspectorUI->rebuildPropertyUI(PROPERTY_AREA);
- } // if ( ActuatingPropertyName == PROPERTY_FILLSTYLE || ActuatingPropertyName == PROPERTY_FILLCOLOR )
- else if ( ActuatingPropertyName == PROPERTY_FILLCOLOR )
- {
- if ( m_xReportComponent.is() && m_xReportComponent->getPropertySetInfo()->hasPropertyByName(PROPERTY_FILLSTYLE) )
- {
- drawing::FillStyle aFillStyle;
- m_xReportComponent->getPropertyValue( PROPERTY_FILLSTYLE ) >>= aFillStyle;
- _rxInspectorUI->enablePropertyUI(PROPERTY_FILLCOLOR,aFillStyle == drawing::FillStyle_SOLID);
- }
- }
- else
+ const sal_Int32 nId = m_pInfoService->getPropertyId(ActuatingPropertyName);
+ switch(nId)
{
- const sal_Int32 nId = m_pInfoService->getPropertyId(ActuatingPropertyName);
- switch(nId)
- {
- case PROPERTY_ID_TYPE:
- {
- sal_uInt32 nNewVal = 0;
- NewValue >>= nNewVal;
- switch(nNewVal)
- {
- case DATA_OR_FORMULA:
- _rxInspectorUI->rebuildPropertyUI(PROPERTY_DATAFIELD);
- _rxInspectorUI->enablePropertyUI(PROPERTY_DATAFIELD,sal_True);
- _rxInspectorUI->enablePropertyUI(PROPERTY_FORMULALIST,sal_False);
- _rxInspectorUI->enablePropertyUI(PROPERTY_SCOPE,sal_False);
- OSL_ENSURE(m_sDefaultFunction.getLength() == 0,"Why is the m_sDefaultFunction set?");
- OSL_ENSURE(m_sScope.getLength() == 0,"Why is the m_sScope set?");
- break;
- case FUNCTION:
- _rxInspectorUI->rebuildPropertyUI(PROPERTY_DATAFIELD);
- _rxInspectorUI->rebuildPropertyUI(PROPERTY_FORMULALIST);
- _rxInspectorUI->enablePropertyUI(PROPERTY_DATAFIELD,sal_True);
- _rxInspectorUI->enablePropertyUI(PROPERTY_FORMULALIST,m_sDefaultFunction.getLength() != 0);
- _rxInspectorUI->enablePropertyUI(PROPERTY_SCOPE,m_sScope.getLength() != 0);
- break;
- case USER_DEF_FUNCTION:
- _rxInspectorUI->enablePropertyUI(PROPERTY_DATAFIELD,sal_False);
- _rxInspectorUI->enablePropertyUI(PROPERTY_FORMULALIST,sal_True);
- _rxInspectorUI->rebuildPropertyUI(PROPERTY_FORMULALIST);
- _rxInspectorUI->enablePropertyUI(PROPERTY_SCOPE,sal_False);
- break;
- case COUNTER:
- _rxInspectorUI->enablePropertyUI(PROPERTY_DATAFIELD,sal_False);
- _rxInspectorUI->enablePropertyUI(PROPERTY_FORMULALIST,sal_False);
- _rxInspectorUI->enablePropertyUI(PROPERTY_SCOPE,sal_True);
- break;
- }
- }
- break;
- case PROPERTY_ID_DATAFIELD:
+ case PROPERTY_ID_TYPE:
+ {
+ sal_uInt32 nNewVal = 0;
+ NewValue >>= nNewVal;
+ switch(nNewVal)
{
- sal_Bool bEnable = (m_nDataFieldType != DATA_OR_FORMULA && m_nDataFieldType != COUNTER );
- if ( bEnable )
- {
- ::rtl::OUString sValue;
- m_xReportComponent->getPropertyValue( PROPERTY_DATAFIELD ) >>= sValue;
- bEnable = sValue.getLength() != 0;
- }
- _rxInspectorUI->enablePropertyUI(PROPERTY_FORMULALIST,bEnable);
- if ( bEnable )
- {
+ case DATA_OR_FORMULA:
+ _rxInspectorUI->rebuildPropertyUI(PROPERTY_DATAFIELD);
+ _rxInspectorUI->enablePropertyUI(PROPERTY_DATAFIELD,sal_True);
+ _rxInspectorUI->enablePropertyUI(PROPERTY_FORMULALIST,sal_False);
+ _rxInspectorUI->enablePropertyUI(PROPERTY_SCOPE,sal_False);
+ OSL_ENSURE(m_sDefaultFunction.getLength() == 0,"Why is the m_sDefaultFunction set?");
+ OSL_ENSURE(m_sScope.getLength() == 0,"Why is the m_sScope set?");
+ break;
+ case FUNCTION:
_rxInspectorUI->rebuildPropertyUI(PROPERTY_DATAFIELD);
_rxInspectorUI->rebuildPropertyUI(PROPERTY_FORMULALIST);
- }
+ _rxInspectorUI->enablePropertyUI(PROPERTY_DATAFIELD,sal_True);
+ _rxInspectorUI->enablePropertyUI(PROPERTY_FORMULALIST,m_sDefaultFunction.getLength() != 0);
+ _rxInspectorUI->enablePropertyUI(PROPERTY_SCOPE,m_sScope.getLength() != 0);
+ break;
+ case USER_DEF_FUNCTION:
+ _rxInspectorUI->enablePropertyUI(PROPERTY_DATAFIELD,sal_False);
+ _rxInspectorUI->enablePropertyUI(PROPERTY_FORMULALIST,sal_True);
+ _rxInspectorUI->rebuildPropertyUI(PROPERTY_FORMULALIST);
+ _rxInspectorUI->enablePropertyUI(PROPERTY_SCOPE,sal_False);
+ break;
+ case COUNTER:
+ _rxInspectorUI->enablePropertyUI(PROPERTY_DATAFIELD,sal_False);
+ _rxInspectorUI->enablePropertyUI(PROPERTY_FORMULALIST,sal_False);
+ _rxInspectorUI->enablePropertyUI(PROPERTY_SCOPE,sal_True);
+ break;
}
- break;
- case PROPERTY_ID_FORMULALIST:
+ }
+ break;
+ case PROPERTY_ID_DATAFIELD:
+ {
+ sal_Bool bEnable = (m_nDataFieldType != DATA_OR_FORMULA && m_nDataFieldType != COUNTER );
+ if ( bEnable )
{
- _rxInspectorUI->enablePropertyUI(PROPERTY_SCOPE,m_nDataFieldType == FUNCTION || m_nDataFieldType == COUNTER);
+ ::rtl::OUString sValue;
+ m_xReportComponent->getPropertyValue( PROPERTY_DATAFIELD ) >>= sValue;
+ bEnable = sValue.getLength() != 0;
}
- break;
- case PROPERTY_ID_BACKTRANSPARENT:
- case PROPERTY_ID_CONTROLBACKGROUNDTRANSPARENT:
+ _rxInspectorUI->enablePropertyUI(PROPERTY_FORMULALIST,bEnable);
+ if ( bEnable )
{
- sal_Bool bValue = sal_False;
- NewValue >>= bValue;
- bValue = !bValue;
- _rxInspectorUI->enablePropertyUI(PROPERTY_BACKCOLOR,bValue);
- _rxInspectorUI->enablePropertyUI(PROPERTY_CONTROLBACKGROUND,bValue);
+ _rxInspectorUI->rebuildPropertyUI(PROPERTY_DATAFIELD);
+ _rxInspectorUI->rebuildPropertyUI(PROPERTY_FORMULALIST);
}
- break;
- default:
- m_xFormComponentHandler->actuatingPropertyChanged(ActuatingPropertyName, NewValue, OldValue, _rxInspectorUI, _bFirstTimeInit);
- break;
- } // switch(nId)
+ }
+ break;
+ case PROPERTY_ID_FORMULALIST:
+ {
+ _rxInspectorUI->enablePropertyUI(PROPERTY_SCOPE,m_nDataFieldType == FUNCTION || m_nDataFieldType == COUNTER);
+ }
+ break;
+ case PROPERTY_ID_BACKTRANSPARENT:
+ case PROPERTY_ID_CONTROLBACKGROUNDTRANSPARENT:
+ {
+ sal_Bool bValue = sal_False;
+ NewValue >>= bValue;
+ bValue = !bValue;
+ _rxInspectorUI->enablePropertyUI(PROPERTY_BACKCOLOR,bValue);
+ _rxInspectorUI->enablePropertyUI(PROPERTY_CONTROLBACKGROUND,bValue);
+ }
+ break;
+ default:
+ m_xFormComponentHandler->actuatingPropertyChanged(ActuatingPropertyName, NewValue, OldValue, _rxInspectorUI, _bFirstTimeInit);
+ break;
}
}
@@ -1525,6 +1496,7 @@ void SAL_CALL GeometryHandler::actuatingPropertyChanged(const ::rtl::OUString &
{
return m_xFormComponentHandler->suspend(Suspend);
}
+// -----------------------------------------------------------------------------
bool GeometryHandler::impl_dialogFilter_nothrow( ::rtl::OUString& _out_rSelectedClause, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const
{
_out_rSelectedClause = ::rtl::OUString();
@@ -2060,7 +2032,7 @@ void GeometryHandler::impl_initFieldList_nothrow( uno::Sequence< ::rtl::OUString
}
catch (uno::Exception&)
{
- DBG_ERROR( "GeometryHandler::impl_initFieldList_nothrow: caught an exception!" );
+ DBG_ERROR( "GeometryHandler::impl_initFieldList_nothrow: caught an exception!" )
}
}
// -----------------------------------------------------------------------------
diff --git a/reportdesign/source/ui/misc/FunctionHelper.cxx b/reportdesign/source/ui/misc/FunctionHelper.cxx
new file mode 100644
index 000000000000..71505e26a781
--- /dev/null
+++ b/reportdesign/source/ui/misc/FunctionHelper.cxx
@@ -0,0 +1,260 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: formula.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#include "precompiled_reportdesign.hxx"
+#include "FunctionHelper.hxx"
+#include <tools/debug.hxx>
+
+// =============================================================================
+namespace rptui
+{
+// =============================================================================
+ using namespace ::com::sun::star;
+
+FunctionManager::FunctionManager(const uno::Reference< report::meta::XFunctionManager>& _xMgr)
+: m_xMgr(_xMgr)
+{
+}
+FunctionManager::~FunctionManager()
+{
+}
+const sal_Unicode FunctionManager::getSingleToken(const formula::IFunctionManager::EToken _eToken) const
+{
+ switch(_eToken)
+ {
+ case eOk:
+ return sal_Unicode('(');
+ case eClose:
+ return sal_Unicode(')');
+ case eSep:
+ return sal_Unicode(';');
+ case eArrayOpen:
+ return sal_Unicode('{');
+ case eArrayClose:
+ return sal_Unicode('}');
+ } // switch(_eToken)
+ return 0;
+}
+// -----------------------------------------------------------------------------
+sal_uInt32 FunctionManager::getCount() const
+{
+ return m_xMgr->getCount();
+}
+// -----------------------------------------------------------------------------
+const formula::IFunctionCategory* FunctionManager::getCategory(sal_uInt32 _nPos) const
+{
+ if ( _nPos >= m_aCategoryIndex.size() )
+ {
+ uno::Reference< report::meta::XFunctionCategory> xCategory = m_xMgr->getCategory(_nPos);
+ ::boost::shared_ptr< FunctionCategory > pCategory(new FunctionCategory(this,_nPos + 1,xCategory));
+ m_aCategoryIndex.push_back( m_aCategories.insert(TCategoriesMap::value_type(xCategory->getName(),pCategory)).first );
+ }
+ return m_aCategoryIndex[_nPos]->second.get();
+}
+// -----------------------------------------------------------------------------
+const formula::IFunctionDescription* FunctionManager::getFunctionByName(const ::rtl::OUString& _sFunctionName) const
+{
+ const formula::IFunctionDescription* pDesc = NULL;
+ try
+ {
+ pDesc = get(m_xMgr->getFunctionByName(_sFunctionName)).get();
+ }
+ catch(uno::Exception&)
+ {
+ }
+ return pDesc;
+}
+// -----------------------------------------------------------------------------
+void FunctionManager::fillLastRecentlyUsedFunctions(::std::vector< const formula::IFunctionDescription*>& /*_rLastRUFunctions*/) const
+{
+ //const sal_uInt32 nCount = getCount();
+ //for(sal_uInt32 i = 0 ; i < nCount ; ++i)
+ //{
+ // const formula::IFunctionCategory* pCategory = getCategory(
+ //}
+}
+// -----------------------------------------------------------------------------
+::boost::shared_ptr< FunctionDescription > FunctionManager::get(const uno::Reference< report::meta::XFunctionDescription>& _xFunctionDescription) const
+{
+ ::boost::shared_ptr< FunctionDescription > pDesc;
+ if ( _xFunctionDescription.is() )
+ {
+ const ::rtl::OUString sFunctionName = _xFunctionDescription->getName();
+ TFunctionsMap::const_iterator aFunctionFind = m_aFunctions.find(sFunctionName);
+ if ( aFunctionFind == m_aFunctions.end() )
+ {
+ const uno::Reference< report::meta::XFunctionCategory> xCategory = _xFunctionDescription->getCategory();
+ const ::rtl::OUString sCategoryName = xCategory->getName();
+ TCategoriesMap::iterator aCategoryFind = m_aCategories.find(sCategoryName);
+ if ( aCategoryFind == m_aCategories.end() )
+ {
+ aCategoryFind = m_aCategories.insert(TCategoriesMap::value_type(sCategoryName,::boost::shared_ptr< FunctionCategory > (new FunctionCategory(this,xCategory->getNumber() + 1,xCategory)))).first;
+ m_aCategoryIndex.push_back( aCategoryFind );
+ }
+ aFunctionFind = m_aFunctions.insert(TFunctionsMap::value_type(sFunctionName,::boost::shared_ptr<FunctionDescription>(new FunctionDescription(aCategoryFind->second.get(),_xFunctionDescription)))).first;
+ } // if ( aFind == m_aFunctions.end() )
+ pDesc = aFunctionFind->second;
+ } // if ( _xFunctionDescription.is() )
+ return pDesc;
+}
+// -----------------------------------------------------------------------------
+FunctionCategory::FunctionCategory(const FunctionManager* _pFMgr,sal_uInt32 _nPos,const uno::Reference< report::meta::XFunctionCategory>& _xCategory)
+: m_xCategory(_xCategory)
+,m_nFunctionCount(_xCategory->getCount())
+, m_nNumber(_nPos)
+,m_pFunctionManager(_pFMgr)
+{
+}
+// -----------------------------------------------------------------------------
+sal_uInt32 FunctionCategory::getCount() const
+{
+ return m_nFunctionCount;
+}
+// -----------------------------------------------------------------------------
+const formula::IFunctionDescription* FunctionCategory::getFunction(sal_uInt32 _nPos) const
+{
+ if ( _nPos >= m_aFunctions.size() && _nPos < m_nFunctionCount )
+ {
+ uno::Reference< report::meta::XFunctionDescription> xFunctionDescription = m_xCategory->getFunction(_nPos);
+ ::boost::shared_ptr< FunctionDescription > pFunction = m_pFunctionManager->get(xFunctionDescription);
+ m_aFunctions.push_back( pFunction );
+ }
+ return m_aFunctions[_nPos].get();
+}
+// -----------------------------------------------------------------------------
+sal_uInt32 FunctionCategory::getNumber() const
+{
+ return m_nNumber;
+}
+// -----------------------------------------------------------------------------
+const formula::IFunctionManager* FunctionCategory::getFunctionManager() const
+{
+ return m_pFunctionManager;
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString FunctionCategory::getName() const
+{
+ return m_xCategory->getName();
+}
+// -----------------------------------------------------------------------------
+FunctionDescription::FunctionDescription(const formula::IFunctionCategory* _pFunctionCategory,const uno::Reference< report::meta::XFunctionDescription>& _xFunctionDescription)
+: m_xFunctionDescription(_xFunctionDescription)
+, m_pFunctionCategory(_pFunctionCategory)
+{
+ m_aParameter = m_xFunctionDescription->getArguments();
+}
+::rtl::OUString FunctionDescription::getFunctionName() const
+{
+ return m_xFunctionDescription->getName();
+}
+// -----------------------------------------------------------------------------
+const formula::IFunctionCategory* FunctionDescription::getCategory() const
+{
+ return m_pFunctionCategory;
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString FunctionDescription::getDescription() const
+{
+ return m_xFunctionDescription->getDescription();
+}
+// -----------------------------------------------------------------------------
+xub_StrLen FunctionDescription::getSuppressedArgumentCount() const
+{
+ return static_cast<xub_StrLen>(m_aParameter.getLength());
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString FunctionDescription::getFormula(const ::std::vector< ::rtl::OUString >& _aArguments) const
+{
+ ::rtl::OUString sFormula;
+ try
+ {
+ const ::rtl::OUString *pArguments = _aArguments.empty() ? 0 : &_aArguments[0];
+ sFormula = m_xFunctionDescription->createFormula(uno::Sequence< ::rtl::OUString >(pArguments, _aArguments.size()));
+ }
+ catch(const uno::Exception&)
+ {
+ DBG_ERROR("Exception caught!");
+ }
+ return sFormula;
+}
+// -----------------------------------------------------------------------------
+void FunctionDescription::fillVisibleArgumentMapping(::std::vector<USHORT>& _rArguments) const
+{
+ const sal_Int32 nCount = m_aParameter.getLength();
+ for(USHORT i = 0;i < nCount; ++i)
+ {
+ _rArguments.push_back(i);
+ }
+}
+// -----------------------------------------------------------------------------
+void FunctionDescription::initArgumentInfo() const
+{
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString FunctionDescription::getSignature() const
+{
+ return m_xFunctionDescription->getSignature();
+}
+// -----------------------------------------------------------------------------
+long FunctionDescription::getHelpId() const
+{
+ return 0;
+}
+// -----------------------------------------------------------------------------
+sal_uInt32 FunctionDescription::getParameterCount() const
+{
+ return m_aParameter.getLength();
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString FunctionDescription::getParameterName(sal_uInt32 _nPos) const
+{
+ if ( _nPos < static_cast<sal_uInt32>(m_aParameter.getLength()) )
+ return m_aParameter[_nPos].Name;
+ return ::rtl::OUString();
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString FunctionDescription::getParameterDescription(sal_uInt32 _nPos) const
+{
+ if ( _nPos < static_cast<sal_uInt32>(m_aParameter.getLength()) )
+ return m_aParameter[_nPos].Description;
+ return ::rtl::OUString();
+}
+// -----------------------------------------------------------------------------
+bool FunctionDescription::isParameterOptional(sal_uInt32 _nPos) const
+{
+ if ( _nPos < static_cast<sal_uInt32>(m_aParameter.getLength()) )
+ return m_aParameter[_nPos].IsOptional;
+ return false;
+}
+// -----------------------------------------------------------------------------
+// =============================================================================
+} // rptui
+// =============================================================================
diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx
index 58582c2d1034..07279abcb26d 100644
--- a/reportdesign/source/ui/misc/UITools.cxx
+++ b/reportdesign/source/ui/misc/UITools.cxx
@@ -34,6 +34,9 @@
#include <toolkit/helper/vclunohelper.hxx>
#include "SectionView.hxx"
#include "UITools.hxx"
+#include "Formula.hxx"
+#include "FunctionHelper.hxx"
+#include "reportformula.hxx"
#include <tools/diagnose_ex.h>
#include <tools/string.hxx>
@@ -90,11 +93,17 @@
#include <comphelper/propmultiplex.hxx>
#include <comphelper/namedvaluecollection.hxx>
+#include <connectivity/dbexception.hxx>
+#include <connectivity/dbconversion.hxx>
+#include <connectivity/dbtools.hxx>
+
#include <com/sun/star/report/XGroups.hpp>
#include <com/sun/star/awt/TextAlign.hpp>
#include <com/sun/star/text/ParagraphVertAlign.hpp>
#include <com/sun/star/report/XShape.hpp>
+#include <com/sun/star/report/Function.hpp>
#include <com/sun/star/sdb/XParametersSupplier.hpp>
+#include <com/sun/star/sdb/SQLContext.hpp>
#include <i18npool/mslangid.hxx>
#include "dlgpage.hxx"
#include <vcl/msgbox.hxx>
@@ -155,6 +164,7 @@
namespace rptui
{
using namespace ::com::sun::star;
+using namespace formula;
// -----------------------------------------------------------------------------
SvxCellHorJustify lcl_MapHorizontalAlignment(const sal_Int16 _nAlign)
{
@@ -823,7 +833,7 @@ bool openCharDialog( const uno::Reference<report::XReportControlFormat >& _rxRep
// -----------------------------------------------------------------------------
bool openAreaDialog( const uno::Reference<report::XShape >& _xShape,const uno::Reference< awt::XWindow>& _rxParentWindow )
{
- OSL_PRECOND( _xShape.is() && _rxParentWindow.is(), "openCharDialog: invalid parameters!" );
+ OSL_PRECOND( _xShape.is() && _rxParentWindow.is(), "openAreaDialog: invalid parameters!" );
if ( !_xShape.is() || !_rxParentWindow.is() )
return false;
@@ -1090,5 +1100,57 @@ void setZoomFactor(const Fraction& _aZoom,Window& _rWindow)
_rWindow.SetMapMode(aMapMode);
}
// -----------------------------------------------------------------------------
+bool openDialogFormula_nothrow( ::rtl::OUString& _in_out_rFormula
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _xContext
+ , const uno::Reference< awt::XWindow>& _xInspectorWindow
+ , const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet >& _xRowSet
+ )
+{
+ OSL_PRECOND( _xInspectorWindow.is(), "openDialogFormula_nothrow: invalid parameters!" );
+ if ( !_xInspectorWindow.is() )
+ return false;
+ // _out_rFormula = ::rtl::OUString();
+ bool bSuccess = false;
+ ::dbtools::SQLExceptionInfo aErrorInfo;
+ uno::Reference< awt::XWindow > xInspectorWindow;
+ uno::Reference< lang::XMultiComponentFactory > xFactory;
+ uno::Reference<lang::XMultiServiceFactory> xServiceFactory;
+ try
+ {
+ xFactory = _xContext->getServiceManager();
+ xServiceFactory.set(xFactory,uno::UNO_QUERY);
+ Window* pParent = VCLUnoHelper::GetWindow( _xInspectorWindow );
+
+ uno::Reference< report::meta::XFunctionManager> xMgr(xFactory->createInstanceWithContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.report.pentaho.SOFunctionManager")),_xContext),uno::UNO_QUERY);
+ if ( xMgr.is() )
+ {
+ ::boost::shared_ptr< formula::IFunctionManager > pFormulaManager(new FunctionManager(xMgr) );
+ ReportFormula aFormula( _in_out_rFormula );
+ FormulaDialog aDlg(pParent,xServiceFactory,pFormulaManager,aFormula.getUndecoratedContent(),_xRowSet);
+ bSuccess = aDlg.Execute() == RET_OK;
+ if ( bSuccess )
+ {
+ String sFormula = aDlg.getCurrentFormula();
+ xub_StrLen nIndex = 0;
+ if ( sFormula.GetChar(0) == '=' )
+ nIndex = 1;
+ _in_out_rFormula = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:")) + sFormula.Copy(nIndex);
+ }
+ }
+ }
+ catch (sdb::SQLContext& e) { aErrorInfo = e; }
+ catch (sdbc::SQLWarning& e) { aErrorInfo = e; }
+ catch (sdbc::SQLException& e) { aErrorInfo = e; }
+ catch( const uno::Exception& )
+ {
+ OSL_ENSURE( sal_False, "GeometryHandler::impl_dialogFilter_nothrow: caught an exception!" );
+ }
+
+ if ( aErrorInfo.isValid() )
+ ::dbtools::showError( aErrorInfo, xInspectorWindow, xServiceFactory );
+
+ return bSuccess;
+}
+// -----------------------------------------------------------------------------
} // namespace rptui
// -----------------------------------------------------------------------------
diff --git a/reportdesign/source/ui/misc/makefile.mk b/reportdesign/source/ui/misc/makefile.mk
index ce63ddf07964..75671f00f253 100644
--- a/reportdesign/source/ui/misc/makefile.mk
+++ b/reportdesign/source/ui/misc/makefile.mk
@@ -50,7 +50,8 @@ EXCEPTIONSFILES= \
$(SLO)$/UITools.obj \
$(SLO)$/rptuiservices.obj \
$(SLO)$/toolboxcontroller.obj \
- $(SLO)$/statusbarcontroller.obj
+ $(SLO)$/statusbarcontroller.obj \
+ $(SLO)$/FunctionHelper.obj
SLOFILES= \
diff --git a/reportdesign/source/ui/report/DesignView.cxx b/reportdesign/source/ui/report/DesignView.cxx
index 342812f1deea..2096dd43ed39 100644
--- a/reportdesign/source/ui/report/DesignView.cxx
+++ b/reportdesign/source/ui/report/DesignView.cxx
@@ -159,8 +159,7 @@ ODesignView::ODesignView( Window* pParent,
,m_nCurrentPosition(USHRT_MAX)
,m_eActObj( OBJ_NONE )
,m_bFirstDraw(FALSE)
- ,m_aGridSizeCoarse( 1000, 1000 ) // #i93595# 100TH_MM changed to grid using coarse 1 cm grid
- ,m_aGridSizeFine( 250, 250 ) // and a 0,25 cm subdivision for better visualisation
+ ,m_aGridSize( 250, 250 ) // 100TH_MM
,m_bGridVisible(TRUE)
,m_bGridSnap(TRUE)
,m_bDeleted( FALSE )
@@ -600,12 +599,12 @@ void ODesignView::toggleAddField()
uno::Reference< report::XSection > xSection = m_pCurrentView->getReportSection()->getSection();
xReport = xSection->getReportDefinition();
}
- uno::Reference < beans::XPropertySet > xSet(rReportController.getRowSet(),uno::UNO_QUERY);
- m_pAddField = new OAddFieldWindow(this,xSet);
+ uno::Reference < beans::XPropertySet > xSet(rReportController.getRowSet(),uno::UNO_QUERY);
+ m_pAddField = new OAddFieldWindow(this,xSet);
m_pAddField->SetCreateHdl(LINK( &rReportController, OReportController, OnCreateHdl ) );
- SvtViewOptions aDlgOpt( E_WINDOW, String::CreateFromInt32( UID_RPT_RPT_APP_VIEW ) );
- if ( aDlgOpt.Exists() )
- m_pAddField->SetWindowState( ByteString( aDlgOpt.GetWindowState().getStr(), RTL_TEXTENCODING_ASCII_US ) );
+ SvtViewOptions aDlgOpt( E_WINDOW, String::CreateFromInt32( UID_RPT_RPT_APP_VIEW ) );
+ if ( aDlgOpt.Exists() )
+ m_pAddField->SetWindowState( ByteString( aDlgOpt.GetWindowState().getStr(), RTL_TEXTENCODING_ASCII_US ) );
m_pAddField->Update();
m_pAddField->AddEventListener(LINK(&rReportController,OReportController,EventLstHdl));
notifySystemWindow(this,m_pAddField,::comphelper::mem_fun(&TaskPaneList::AddWindow));
@@ -765,14 +764,19 @@ sal_uInt32 ODesignView::getMarkedObjectCount() const
return m_aScrollWindow.getMarkedObjectCount();
}
// -----------------------------------------------------------------------------
-void ODesignView::zoom(const Fraction& _aZoom)
+void ODesignView::zoom(const sal_Int16 _nZoom)
{
- m_aScrollWindow.zoom(_aZoom);
+ m_aScrollWindow.zoom(_nZoom);
}
// -----------------------------------------------------------------------------
-sal_uInt16 ODesignView::getZoomFactor(SvxZoomType _eType) const
+uno::Sequence< beans::PropertyValue > ODesignView::getSelectedFieldDescriptors()
{
- return m_aScrollWindow.getZoomFactor(_eType);
+ uno::Sequence< beans::PropertyValue > aArgs;
+ if ( isAddFieldVisible() )
+ {
+ aArgs = m_pAddField->getSelectedFieldDescriptors();
+ }
+ return aArgs;
}
//============================================================================
} // rptui
diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx
index 7ecd18a7c74b..3602e76a76e1 100644
--- a/reportdesign/source/ui/report/ReportController.cxx
+++ b/reportdesign/source/ui/report/ReportController.cxx
@@ -60,6 +60,7 @@
#include <tools/diagnose_ex.h>
#include "rptui_slotid.hrc"
#include "reportformula.hxx"
+#include "AddField.hxx"
#include <comphelper/documentconstants.hxx>
#include <comphelper/property.hxx>
@@ -118,9 +119,6 @@
#include <svx/brshitem.hxx>
#include <svx/flagsdef.hxx> //CHINA001
#include <svx/svdpagv.hxx>
-#include <svx/svxdlg.hxx>
-#include <svx/zoom_def.hxx>
-#include <svx/dialogs.hrc>
#include "DesignView.hxx"
#include "ModuleHelper.hxx"
@@ -286,7 +284,7 @@ DBG_NAME( rpt_OReportController )
OReportController::OReportController(Reference< XComponentContext > const & xContext)
: OReportController_BASE(Reference< XMultiServiceFactory >(xContext->getServiceManager(),UNO_QUERY))
,OPropertyStateContainer(OGenericUnoController_Base::rBHelper)
-,m_aSelectionListeners( getMutex() )
+,m_aSelectionListeners( m_aMutex )
,m_pMyOwnView(NULL)
,m_pClipbordNotifier(NULL)
,m_pGroupsFloater(NULL)
@@ -295,7 +293,6 @@ OReportController::OReportController(Reference< XComponentContext > const & xCon
,m_nPageNum(-1)
,m_nSelectionCount(0)
,m_nZoomValue(100)
-,m_eZoomType(SVX_ZOOM_PERCENT)
,m_bShowRuler(sal_True)
,m_bGridVisible(sal_True)
,m_bGridUse(sal_True)
@@ -307,7 +304,7 @@ OReportController::OReportController(Reference< XComponentContext > const & xCon
{
m_sMode = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("normal"));
DBG_CTOR( rpt_OReportController,NULL);
- registerProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ZoomValue")),PROPERTY_ID_ZOOMVALUE,beans::PropertyAttribute::BOUND| beans::PropertyAttribute::TRANSIENT,&m_nZoomValue,::getCppuType(reinterpret_cast< sal_Int16*>(NULL)));
+ registerProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ZoomValue")),PROPERTY_ID_ZOOMVALUE,beans::PropertyAttribute::BOUND| beans::PropertyAttribute::TRANSIENT, &m_nZoomValue, ::getCppuType(reinterpret_cast< sal_Int16*>(NULL)));
}
// -----------------------------------------------------------------------------
OReportController::~OReportController()
@@ -902,8 +899,8 @@ FeatureState OReportController::GetState(sal_uInt16 _nId) const
case SID_ATTR_ZOOM:
aReturn.bEnabled = sal_True;
{
- SvxZoomItem aZoom(m_eZoomType,m_nZoomValue);
- aZoom.SetValueSet(SVX_ZOOM_ENABLE_50|SVX_ZOOM_ENABLE_75|SVX_ZOOM_ENABLE_100|SVX_ZOOM_ENABLE_200);
+ SvxZoomItem aZoom(SVX_ZOOM_PERCENT,m_nZoomValue);
+ aZoom.SetValueSet(SVX_ZOOM_ENABLE_50|SVX_ZOOM_ENABLE_75|SVX_ZOOM_ENABLE_100|SVX_ZOOM_ENABLE_150|SVX_ZOOM_ENABLE_200);
aZoom.QueryValue(aReturn.aValue);
//aReturn.sTitle = ::rtl::OUString::valueOf((sal_Int32)m_nZoomValue);
}
@@ -911,10 +908,11 @@ FeatureState OReportController::GetState(sal_uInt16 _nId) const
case SID_ATTR_ZOOMSLIDER:
aReturn.bEnabled = sal_True;
{
- SvxZoomSliderItem aZoomSlider(m_nZoomValue,20,400);
+ SvxZoomSliderItem aZoomSlider(m_nZoomValue);
aZoomSlider.AddSnappingPoint(50);
aZoomSlider.AddSnappingPoint(75);
aZoomSlider.AddSnappingPoint(100);
+ aZoomSlider.AddSnappingPoint(150);
aZoomSlider.AddSnappingPoint(200);
aZoomSlider.QueryValue(aReturn.aValue);
//aReturn.sTitle = ::rtl::OUString::valueOf((sal_Int32)m_nZoomValue);
@@ -954,7 +952,7 @@ namespace
void OReportController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >& aArgs)
{
::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
- ::osl::MutexGuard aGuard( getMutex() );
+ ::osl::MutexGuard aGuard(m_aMutex);
if ( !getView() )
{
switch(_nId)
@@ -1601,16 +1599,11 @@ void OReportController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >
case SID_GROUP:
break;
case SID_ATTR_ZOOM:
- if ( aArgs.getLength() == 0 )
- {
- openZoomDialog();
- }
- else if ( aArgs.getLength() == 1 && aArgs[0].Name.equalsAscii("Zoom") )
+ if ( aArgs.getLength() == 1 && aArgs[0].Name.equalsAscii("Zoom") )
{
SvxZoomItem aZoomItem;
aZoomItem.PutValue(aArgs[0].Value);
m_nZoomValue = aZoomItem.GetValue();
- m_eZoomType = aZoomItem.GetType();
impl_zoom_nothrow();
} // if ( aArgs.getLength() == 1 && aArgs[0].Name.equalsAscii("Zoom") )
break;
@@ -1620,7 +1613,6 @@ void OReportController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >
SvxZoomSliderItem aZoomSlider;
aZoomSlider.PutValue(aArgs[0].Value);
m_nZoomValue = aZoomSlider.GetValue();
- m_eZoomType = SVX_ZOOM_PERCENT;
impl_zoom_nothrow();
}
break;
@@ -1745,6 +1737,18 @@ IMPL_LINK( OReportController, OnCreateHdl, OAddFieldWindow* ,_pAddFieldDlg)
return 0L;
}
// -----------------------------------------------------------------------------
+IMPL_LINK( OReportController, OnCreateHdl, OAddFieldWindow* ,_pAddFieldDlg)
+{
+ WaitObject aObj(m_pMyOwnView);
+ uno::Sequence< beans::PropertyValue > aArgs = _pAddFieldDlg->getSelectedFieldDescriptors();
+ // we use this way to create undo actions
+ if ( aArgs.getLength() )
+ {
+ executeChecked(SID_ADD_CONTROL_PAIR,aArgs);
+ }
+ return 0L;
+}
+// -----------------------------------------------------------------------------
void OReportController::doOpenHelpAgent()
{
@@ -1786,7 +1790,7 @@ sal_Bool SAL_CALL OReportController::suspend(sal_Bool /*_bSuspend*/) throw( Runt
return sal_True;
vos::OGuard aSolarGuard( Application::GetSolarMutex() );
- ::osl::MutexGuard aGuard( getMutex() );
+ ::osl::MutexGuard aGuard(m_aMutex);
if ( getView() && getView()->IsInModalMode() )
return sal_False;
@@ -2060,7 +2064,7 @@ SfxUndoManager* OReportController::getUndoMgr()
// -----------------------------------------------------------------------------
void OReportController::setModified(sal_Bool _bModified)
{
- ::osl::MutexGuard aGuard( getMutex() );
+ ::osl::MutexGuard aGuard(m_aMutex);
try
{
if ( m_xReportDefinition.is() )
@@ -2106,7 +2110,7 @@ void OReportController::notifyGroupSections(const ContainerEvent& _rEvent,bool _
if ( xGroup.is() )
{
::vos::OGuard aSolarGuard(Application::GetSolarMutex());
- ::osl::MutexGuard aGuard( getMutex() );
+ ::osl::MutexGuard aGuard(m_aMutex);
sal_Int32 nGroupPos = 0;
_rEvent.Accessor >>= nGroupPos;
@@ -2146,14 +2150,14 @@ void SAL_CALL OReportController::elementRemoved( const ContainerEvent& _rEvent )
void SAL_CALL OReportController::elementReplaced( const ContainerEvent& /*_rEvent*/ ) throw(RuntimeException)
{
::vos::OGuard aSolarGuard(Application::GetSolarMutex());
- ::osl::MutexGuard aGuard( getMutex() );
+ ::osl::MutexGuard aGuard(m_aMutex);
OSL_ENSURE(0,"Not yet implemented!");
}
// -----------------------------------------------------------------------------
void SAL_CALL OReportController::propertyChange( const beans::PropertyChangeEvent& evt ) throw (RuntimeException)
{
::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
- ::osl::MutexGuard aGuard( getMutex() );
+ ::osl::MutexGuard aGuard(m_aMutex);
try
{
sal_Bool bShow = sal_False;
@@ -2411,7 +2415,6 @@ void OReportController::openPageDialog(const uno::Reference<report::XSection>& _
uno::Any aValue;
static_cast<const SvxSizeItem*>(pItem)->QueryValue(aValue,MID_SIZE_SIZE);
xProp->setPropertyValue(PROPERTY_PAPERSIZE,aValue);
- resetZoomType();
}
if ( SFX_ITEM_SET == pSet->GetItemState( RPTUI_ID_LRSPACE,sal_True,&pItem))
@@ -2432,7 +2435,6 @@ void OReportController::openPageDialog(const uno::Reference<report::XSection>& _
uno::Any aValue;
pPageItem->QueryValue(aValue,MID_PAGE_LAYOUT);
xProp->setPropertyValue(PROPERTY_PAGESTYLELAYOUT,aValue);
- resetZoomType();
}
if ( SFX_ITEM_SET == pSet->GetItemState( RPTUI_ID_BRUSH,sal_True,&pItem))
{
@@ -2456,7 +2458,7 @@ void OReportController::openPageDialog(const uno::Reference<report::XSection>& _
// -----------------------------------------------------------------------------
sal_Bool SAL_CALL OReportController::attachModel(const uno::Reference< frame::XModel > & xModel) throw( uno::RuntimeException )
{
- ::osl::MutexGuard aGuard( getMutex() );
+ ::osl::MutexGuard aGuard(m_aMutex);
m_xReportDefinition.set(xModel,uno::UNO_QUERY);
return m_xReportDefinition.is();
}
@@ -2530,7 +2532,7 @@ void OReportController::alignControlsWithUndo(USHORT _nUndoStrId,sal_Int32 _nCon
// -----------------------------------------------------------------------------
uno::Any SAL_CALL OReportController::getViewData(void) throw( uno::RuntimeException )
{
- ::osl::MutexGuard aGuard( getMutex() );
+ ::osl::MutexGuard aGuard(m_aMutex);
typedef ::std::pair< ::rtl::OUString,sal_uInt16> TStringIntPair;
const TStringIntPair pViewDataList[] =
{
@@ -2600,7 +2602,7 @@ uno::Any SAL_CALL OReportController::getViewData(void) throw( uno::RuntimeExcept
// -----------------------------------------------------------------------------
void SAL_CALL OReportController::restoreViewData(const uno::Any& Data) throw( uno::RuntimeException )
{
- ::osl::MutexGuard aGuard( getMutex() );
+ ::osl::MutexGuard aGuard(m_aMutex);
uno::Sequence<beans::PropertyValue> aProps;
if ( Data >>= aProps )
{
@@ -2861,7 +2863,7 @@ void OReportController::insertGraphic()
// -----------------------------------------------------------------------------
::sal_Bool SAL_CALL OReportController::select( const Any& aSelection ) throw (IllegalArgumentException, RuntimeException)
{
- ::osl::MutexGuard aGuard( getMutex() );
+ ::osl::MutexGuard aGuard(m_aMutex);
::sal_Bool bRet = sal_True;
if ( m_pMyOwnView )
{
@@ -2901,7 +2903,7 @@ void OReportController::insertGraphic()
// -----------------------------------------------------------------------------
Any SAL_CALL OReportController::getSelection( ) throw (RuntimeException)
{
- ::osl::MutexGuard aGuard( getMutex() );
+ ::osl::MutexGuard aGuard(m_aMutex);
Any aRet;
if ( m_pMyOwnView )
{
@@ -2978,9 +2980,8 @@ void OReportController::createControl(const Sequence< PropertyValue >& _aArgs,co
}
else
{
- SdrUnoObj* pLabel( NULL );
- SdrUnoObj* pControl( NULL );
- FmFormView::createControlLabelPair(m_pMyOwnView
+ SdrUnoObj* pLabel,*pControl;
+ FmFormView::createControlLabelPair(NULL,m_pMyOwnView
,nLeftMargin,0
,NULL,NULL,_nObjectId,::rtl::OUString(),ReportInventor,OBJ_DLG_FIXEDTEXT,
NULL,pSectionWindow->getReportSection().getPage(),m_aReportModel.get(),
@@ -3119,11 +3120,11 @@ void OReportController::addPairControls(const Sequence< PropertyValue >& aArgs)
pSectionWindow[0] = m_pMyOwnView->getMarkedSection();
if ( !pSectionWindow[0] )
- {
- select(uno::makeAny(m_xReportDefinition->getDetail()));
- pSectionWindow[0] = m_pMyOwnView->getMarkedSection();
- if ( !pSectionWindow[0] )
- return;
+ {
+ select(uno::makeAny(m_xReportDefinition->getDetail()));
+ pSectionWindow[0] = m_pMyOwnView->getMarkedSection();
+ if ( !pSectionWindow[0] )
+ return;
}
uno::Reference<report::XSection> xCurrentSection = m_pMyOwnView->getCurrentSection();
@@ -3275,7 +3276,7 @@ void OReportController::addPairControls(const Sequence< PropertyValue >& aArgs)
pSectionViews[0] = &pSectionWindow[1]->getReportSection().getSectionView();
pSectionViews[1] = &pSectionWindow[0]->getReportSection().getSectionView();
// find this in svx
- FmFormView::createControlLabelPair(m_pMyOwnView
+ FmFormView::createControlLabelPair(pSectionViews[0],m_pMyOwnView
,nLeftMargin,0
,xField,xNumberFormats,nOBJID,::rtl::OUString(),ReportInventor,OBJ_DLG_FIXEDTEXT,
pSectionWindow[1]->getReportSection().getPage(),pSectionWindow[0]->getReportSection().getPage(),m_aReportModel.get(),
@@ -3793,7 +3794,7 @@ void OReportController::checkChartEnabled()
throw (uno::RuntimeException)
{
vos::OGuard aSolarGuard( Application::GetSolarMutex() );
- ::osl::MutexGuard aGuard( getMutex() );
+ ::osl::MutexGuard aGuard(m_aMutex);
uno::Reference< frame::XTitle> xTitle(m_xReportDefinition,uno::UNO_QUERY_THROW);
@@ -3831,12 +3832,12 @@ void SAL_CALL OReportController::setFastPropertyValue_NoBroadcast(sal_Int32 _nHa
}
void SAL_CALL OReportController::setMode( const ::rtl::OUString& aMode ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException)
{
- ::osl::MutexGuard aGuard( getMutex() );
+ ::osl::MutexGuard aGuard(m_aMutex);
m_sMode = aMode;
}
::rtl::OUString SAL_CALL OReportController::getMode( ) throw (::com::sun::star::uno::RuntimeException)
{
- ::osl::MutexGuard aGuard( getMutex() );
+ ::osl::MutexGuard aGuard(m_aMutex);
return m_sMode;
}
::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL OReportController::getSupportedModes( ) throw (::com::sun::star::uno::RuntimeException)
@@ -3902,12 +3903,15 @@ void OReportController::impl_fillState_nothrow(const ::rtl::OUString& _sProperty
void OReportController::impl_zoom_nothrow()
{
Fraction aZoom(m_nZoomValue,100);
- setZoomFactor(aZoom,*m_pMyOwnView);
- m_pMyOwnView->zoom(aZoom);
+ MapMode aMapMode = m_pMyOwnView->GetMapMode();
+ aMapMode.SetScaleX(aZoom);
+ aMapMode.SetScaleY(aZoom);
+ m_pMyOwnView->SetMapMode(aMapMode);
+ m_pMyOwnView->zoom(m_nZoomValue);
// TRY
/*m_pMyOwnView->Invalidate(INVALIDATE_NOCHILDREN);*/
- InvalidateFeature(SID_ATTR_ZOOM,Reference< XStatusListener >(),sal_True);
- InvalidateFeature(SID_ATTR_ZOOMSLIDER,Reference< XStatusListener >(),sal_True);
+ InvalidateFeature(SID_ATTR_ZOOM);
+ InvalidateFeature(SID_ATTR_ZOOMSLIDER);
}
// -----------------------------------------------------------------------------
sal_Bool OReportController::isFormatCommandEnabled(sal_uInt16 _nCommand,const uno::Reference< report::XReportControlFormat>& _xReportControlFormat) const
@@ -3969,58 +3973,3 @@ void OReportController::impl_fillCustomShapeState_nothrow(const char* _pCustomSh
_rState.bChecked = m_pMyOwnView->GetInsertObj() == OBJ_CUSTOMSHAPE && m_pMyOwnView->GetInsertObjString().compareToAscii(_pCustomShapeType) == 0;
}
// -----------------------------------------------------------------------------
-void OReportController::openZoomDialog()
-{
- SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
- if ( pFact )
- {
- static SfxItemInfo aItemInfos[] =
- {
- { SID_ATTR_ZOOM, SFX_ITEM_POOLABLE }
- };
- SfxPoolItem* pDefaults[] =
- {
- new SvxZoomItem()
- };
- static USHORT pRanges[] =
- {
- SID_ATTR_ZOOM,SID_ATTR_ZOOM,
- 0
- };
- try
- {
- ::std::auto_ptr<SfxItemPool> pPool( new SfxItemPool(String::CreateFromAscii("ZoomProperties"), SID_ATTR_ZOOM,SID_ATTR_ZOOM, aItemInfos, pDefaults) );
- pPool->SetDefaultMetric( SFX_MAPUNIT_100TH_MM ); // ripped, don't understand why
- pPool->FreezeIdRanges(); // the same
-
- ::std::auto_ptr<SfxItemSet> pDescriptor(new SfxItemSet(*pPool, pRanges));
- // fill it
- SvxZoomItem aZoomItem( m_eZoomType, m_nZoomValue, SID_ATTR_ZOOM );
- aZoomItem.SetValueSet(SVX_ZOOM_ENABLE_100|SVX_ZOOM_ENABLE_WHOLEPAGE|SVX_ZOOM_ENABLE_PAGEWIDTH);
- pDescriptor->Put(aZoomItem);
-
- ::std::auto_ptr<AbstractSvxZoomDialog> pDlg( pFact->CreateSvxZoomDialog(NULL, *pDescriptor.get(), RID_SVXDLG_ZOOM) );
- pDlg->SetLimits( 20, 400 );
- bool bCancel = ( RET_CANCEL == pDlg->Execute() );
-
- if ( !bCancel )
- {
- const SvxZoomItem& rZoomItem = (const SvxZoomItem&)pDlg->GetOutputItemSet()->Get( SID_ATTR_ZOOM );
- m_eZoomType = rZoomItem.GetType();
- m_nZoomValue = rZoomItem.GetValue();
- if ( m_eZoomType != SVX_ZOOM_PERCENT )
- m_nZoomValue = m_pMyOwnView->getZoomFactor( m_eZoomType );
-
- impl_zoom_nothrow();
- } // if ( !bCancel )
- }
- catch(uno::Exception&)
- {
- DBG_UNHANDLED_EXCEPTION();
- }
-
- for (sal_uInt16 i=0; i<sizeof(pDefaults)/sizeof(pDefaults[0]); ++i)
- delete pDefaults[i];
- } // if(pFact)
-}
-// -----------------------------------------------------------------------------
diff --git a/reportdesign/source/ui/report/report.src b/reportdesign/source/ui/report/report.src
index f213db8248d9..884fac8842b1 100644
--- a/reportdesign/source/ui/report/report.src
+++ b/reportdesign/source/ui/report/report.src
@@ -649,3 +649,8 @@ String RID_STR_REPORT_FOOTER
{
Text [ en-US ] = "Report Footer";
};
+String RID_STR_INSERT
+{
+ Text [ en-US ] = "Insert";
+};
+