[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source sc/uiconfig sc/UIConfig_scalc.mk unodevtools/Executable_skeletonmaker.mk unodevtools/source
Caolán McNamara
caolanm at redhat.com
Thu Apr 11 05:45:39 PDT 2013
sc/UIConfig_scalc.mk | 1
sc/inc/sc.hrc | 2
sc/inc/scabstdlg.hxx | 2
sc/source/ui/attrdlg/scdlgfact.cxx | 22
sc/source/ui/attrdlg/scdlgfact.hxx | 3
sc/source/ui/inc/delcldlg.hxx | 16
sc/source/ui/inc/miscdlgs.hrc | 9
sc/source/ui/miscdlgs/delcldlg.cxx | 51 -
sc/source/ui/src/miscdlgs.src | 68 --
sc/source/ui/view/cellsh1.cxx | 4
sc/uiconfig/scalc/ui/deletecells.ui | 51 -
unodevtools/Executable_skeletonmaker.mk | 1
unodevtools/source/unodevtools/typeblob.cxx | 797 ----------------------------
13 files changed, 61 insertions(+), 966 deletions(-)
New commits:
commit 569ef418f5b0ff2d9e2246f2a16d7d7f090ce4d0
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Apr 11 13:32:24 2013 +0100
adapt code for delete cells dialog
Change-Id: Ibf587e1ea94765f0322a5b847bcf82d1eabc1b64
diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk
index 3ff8973..8f800bf 100644
--- a/sc/UIConfig_scalc.mk
+++ b/sc/UIConfig_scalc.mk
@@ -61,6 +61,7 @@ $(eval $(call gb_UIConfig_add_toolbarfiles,modules/scalc,\
$(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\
sc/uiconfig/scalc/ui/cellprotectionpage \
sc/uiconfig/scalc/ui/definename \
+ sc/uiconfig/scalc/ui/deletecells \
sc/uiconfig/scalc/ui/deletecontents \
sc/uiconfig/scalc/ui/formatcellsdialog \
sc/uiconfig/scalc/ui/insertname \
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index 9d85a5a..4749970 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -951,7 +951,7 @@
#define RID_SCDLG_FILTER (SC_DIALOGS_START + 8)
#define RID_SCDLG_SPEC_FILTER (SC_DIALOGS_START + 9)
-#define RID_SCDLG_DELCELL (SC_DIALOGS_START + 11)
+
#define RID_SCDLG_INSCELL (SC_DIALOGS_START + 12)
#define RID_SCDLG_INSCONT (SC_DIALOGS_START + 14)
diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx
index 7b6c602..89997d4 100644
--- a/sc/inc/scabstdlg.hxx
+++ b/sc/inc/scabstdlg.hxx
@@ -358,7 +358,7 @@ public:
const com::sun::star::uno::Sequence<OUString>& rServices,
int nId ) = 0;
- virtual AbstractScDeleteCellDlg * CreateScDeleteCellDlg( Window* pParent, int nId, sal_Bool bDisallowCellMove = false ) = 0 ; //add for ScDeleteCellDlg
+ virtual AbstractScDeleteCellDlg * CreateScDeleteCellDlg(Window* pParent, bool bDisallowCellMove = false) = 0 ; //add for ScDeleteCellDlg
//for dataform
virtual AbstractScDataFormDlg * CreateScDataFormDlg( Window* pParent, int nId, ScTabViewShell* pTabViewShell ) = 0 ; //add for ScDataFormDlg
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index b6ce1f8..98b656f 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -832,27 +832,13 @@ AbstractScDataPilotServiceDlg* ScAbstractDialogFactory_Impl::CreateScDataPilotSe
// add for ScDataPilotServiceDlg end
-AbstractScDeleteCellDlg* ScAbstractDialogFactory_Impl::CreateScDeleteCellDlg( Window* pParent, int nId,
- sal_Bool bDisallowCellMove )
+AbstractScDeleteCellDlg* ScAbstractDialogFactory_Impl::CreateScDeleteCellDlg(Window* pParent,
+ bool bDisallowCellMove)
{
- ScDeleteCellDlg * pDlg=NULL;
- switch ( nId )
- {
- case RID_SCDLG_DELCELL :
- pDlg = new ScDeleteCellDlg( pParent, bDisallowCellMove );
- break;
- default:
- break;
- }
-
- if ( pDlg )
- return new AbstractScDeleteCellDlg_Impl( pDlg );
- return 0;
+ ScDeleteCellDlg * pDlg = new ScDeleteCellDlg(pParent, bDisallowCellMove);
+ return new AbstractScDeleteCellDlg_Impl( pDlg );
}
-
-
-
AbstractScDataFormDlg* ScAbstractDialogFactory_Impl::CreateScDataFormDlg( Window* pParent, int nId, ScTabViewShell* pTabViewShell )
{
ScDataFormDlg * pDlg=NULL;
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx
index 823eaeb..3383616 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -424,8 +424,7 @@ public:
virtual AbstractScDataPilotServiceDlg * CreateScDataPilotServiceDlg( Window* pParent, //add for ScDataPilotServiceDlg
const com::sun::star::uno::Sequence<OUString>& rServices,
int nId );
- virtual AbstractScDeleteCellDlg * CreateScDeleteCellDlg( Window* pParent, int nId,
- sal_Bool bDisallowCellMove = false ); //add for ScDeleteCellDlg
+ virtual AbstractScDeleteCellDlg * CreateScDeleteCellDlg(Window* pParent, bool bDisallowCellMove = false );
//for dataform
virtual AbstractScDataFormDlg * CreateScDataFormDlg( Window* pParent, int nId, ScTabViewShell* pTabViewShell); //add for ScDeleteCellDlg
diff --git a/sc/source/ui/inc/delcldlg.hxx b/sc/source/ui/inc/delcldlg.hxx
index 97271f4..56d0896 100644
--- a/sc/source/ui/inc/delcldlg.hxx
+++ b/sc/source/ui/inc/delcldlg.hxx
@@ -33,19 +33,13 @@
class ScDeleteCellDlg : public ModalDialog
{
private:
- FixedLine aFlFrame;
- RadioButton aBtnCellsUp;
- RadioButton aBtnCellsLeft;
- RadioButton aBtnDelRows;
- RadioButton aBtnDelCols;
- OKButton aBtnOk;
- CancelButton aBtnCancel;
- HelpButton aBtnHelp;
-
+ RadioButton* m_pBtnCellsUp;
+ RadioButton* m_pBtnCellsLeft;
+ RadioButton* m_pBtnDelRows;
+ RadioButton* m_pBtnDelCols;
public:
- ScDeleteCellDlg( Window* pParent, sal_Bool bDisallowCellMove = false );
- ~ScDeleteCellDlg();
+ ScDeleteCellDlg(Window* pParent, bool bDisallowCellMove = false);
DelCellCmd GetDelCellCmd() const;
};
diff --git a/sc/source/ui/inc/miscdlgs.hrc b/sc/source/ui/inc/miscdlgs.hrc
index e98582f..9efabdc 100644
--- a/sc/source/ui/inc/miscdlgs.hrc
+++ b/sc/source/ui/inc/miscdlgs.hrc
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include "sc.hrc" // -> RID_SCDLG_DELCELL
- // -> RID_SCDLG_INSCELL
+#include "sc.hrc" // -> RID_SCDLG_INSCELL
// -> RID_SCDLG_INSCONT
// -> RID_SCDLG_MOVETAB
// -> RID_SCDLG_STRINPUT
@@ -38,13 +37,9 @@
#define FL_FRAME 112
#define STR_BTN_CLOSE 200
-// Insert/Delete Cell Dialog
-#define BTN_CELLSUP 10
+// Insert Cell Dialog
#define BTN_CELLSDOWN 11
#define BTN_CELLSRIGHT 12
-#define BTN_CELLSLEFT 13
-#define BTN_DELROWS 14
-#define BTN_DELCOLS 15
#define BTN_INSROWS 16
#define BTN_INSCOLS 17
diff --git a/sc/source/ui/miscdlgs/delcldlg.cxx b/sc/source/ui/miscdlgs/delcldlg.cxx
index e2fd6d8..f93a040 100644
--- a/sc/source/ui/miscdlgs/delcldlg.cxx
+++ b/sc/source/ui/miscdlgs/delcldlg.cxx
@@ -33,43 +33,36 @@ static sal_uInt8 nDelItemChecked=0;
//==================================================================
-ScDeleteCellDlg::ScDeleteCellDlg( Window* pParent, sal_Bool bDisallowCellMove ) :
- ModalDialog ( pParent, ScResId( RID_SCDLG_DELCELL ) ),
- //
- aFlFrame ( this, ScResId( FL_FRAME ) ),
- aBtnCellsUp ( this, ScResId( BTN_CELLSUP ) ),
- aBtnCellsLeft ( this, ScResId( BTN_CELLSLEFT ) ),
- aBtnDelRows ( this, ScResId( BTN_DELROWS ) ),
- aBtnDelCols ( this, ScResId( BTN_DELCOLS ) ),
- aBtnOk ( this, ScResId( BTN_OK ) ),
- aBtnCancel ( this, ScResId( BTN_CANCEL ) ),
- aBtnHelp ( this, ScResId( BTN_HELP ) )
+ScDeleteCellDlg::ScDeleteCellDlg(Window* pParent, bool bDisallowCellMove)
+ : ModalDialog(pParent, "DeleteCellsDialog", "modules/scalc/ui/deletecells.ui")
{
+ get(m_pBtnCellsUp, "up");
+ get(m_pBtnCellsLeft, "left");
+ get(m_pBtnDelRows, "rows");
+ get(m_pBtnDelCols, "cols");
if (bDisallowCellMove)
{
- aBtnCellsUp.Disable();
- aBtnCellsLeft.Disable();
+ m_pBtnCellsUp->Disable();
+ m_pBtnCellsLeft->Disable();
switch(nDelItemChecked)
{
- case 2: aBtnDelRows.Check();break;
- case 3: aBtnDelCols.Check();break;
- default:aBtnDelRows.Check();break;
+ case 2: m_pBtnDelRows->Check();break;
+ case 3: m_pBtnDelCols->Check();break;
+ default:m_pBtnDelRows->Check();break;
}
}
else
{
switch(nDelItemChecked)
{
- case 0: aBtnCellsUp.Check();break;
- case 1: aBtnCellsLeft.Check();break;
- case 2: aBtnDelRows.Check();break;
- case 3: aBtnDelCols.Check();break;
+ case 0: m_pBtnCellsUp->Check();break;
+ case 1: m_pBtnCellsLeft->Check();break;
+ case 2: m_pBtnDelRows->Check();break;
+ case 3: m_pBtnDelCols->Check();break;
}
}
-
- FreeResource();
}
//------------------------------------------------------------------------
@@ -78,22 +71,22 @@ DelCellCmd ScDeleteCellDlg::GetDelCellCmd() const
{
DelCellCmd nReturn = DEL_NONE;
- if ( aBtnCellsUp.IsChecked() )
+ if ( m_pBtnCellsUp->IsChecked() )
{
nDelItemChecked=0;
nReturn = DEL_CELLSUP;
}
- else if ( aBtnCellsLeft.IsChecked() )
+ else if ( m_pBtnCellsLeft->IsChecked() )
{
nDelItemChecked=1;
nReturn = DEL_CELLSLEFT;
}
- else if ( aBtnDelRows.IsChecked() )
+ else if ( m_pBtnDelRows->IsChecked() )
{
nDelItemChecked=2;
nReturn = DEL_DELROWS;
}
- else if ( aBtnDelCols.IsChecked() )
+ else if ( m_pBtnDelCols->IsChecked() )
{
nDelItemChecked=3;
nReturn = DEL_DELCOLS;
@@ -102,10 +95,4 @@ DelCellCmd ScDeleteCellDlg::GetDelCellCmd() const
return nReturn;
}
-ScDeleteCellDlg::~ScDeleteCellDlg()
-{
-}
-
-
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/src/miscdlgs.src b/sc/source/ui/src/miscdlgs.src
index 8dcf44a..f7bbd99 100644
--- a/sc/source/ui/src/miscdlgs.src
+++ b/sc/source/ui/src/miscdlgs.src
@@ -19,74 +19,6 @@
#include "miscdlgs.hrc"
-ModalDialog RID_SCDLG_DELCELL
-{
- OutputSize = TRUE ;
- HelpId = CMD_FID_DELETE_CELL ;
- SVLook = TRUE ;
- Size = MAP_APPFONT ( 191 , 70 ) ;
- Text [ en-US ] = "Delete Cells" ;
- Moveable = TRUE ;
- Closeable = FALSE ;
- OKButton BTN_OK
- {
- Pos = MAP_APPFONT ( 135 , 6 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- TabStop = TRUE ;
- DefButton = TRUE ;
- };
- CancelButton BTN_CANCEL
- {
- Pos = MAP_APPFONT ( 135 , 23 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- TabStop = TRUE ;
- };
- HelpButton BTN_HELP
- {
- Pos = MAP_APPFONT ( 135 , 43 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- TabStop = TRUE ;
- };
- RadioButton BTN_DELCOLS
- {
- HelpID = "sc:RadioButton:RID_SCDLG_DELCELL:BTN_DELCOLS";
- Pos = MAP_APPFONT ( 12 , 56 ) ;
- Size = MAP_APPFONT ( 114 , 10 ) ;
- Text [ en-US ] = "Delete entire ~column(s)" ;
- TabStop = TRUE ;
- };
- RadioButton BTN_DELROWS
- {
- HelpID = "sc:RadioButton:RID_SCDLG_DELCELL:BTN_DELROWS";
- Pos = MAP_APPFONT ( 12 , 42 ) ;
- Size = MAP_APPFONT ( 114 , 10 ) ;
- Text [ en-US ] = "Delete entire ~row(s)" ;
- TabStop = TRUE ;
- };
- RadioButton BTN_CELLSLEFT
- {
- HelpID = "sc:RadioButton:RID_SCDLG_DELCELL:BTN_CELLSLEFT";
- Pos = MAP_APPFONT ( 12 , 28 ) ;
- Size = MAP_APPFONT ( 114 , 10 ) ;
- Text [ en-US ] = "Shift cells ~left" ;
- TabStop = TRUE ;
- };
- RadioButton BTN_CELLSUP
- {
- HelpID = "sc:RadioButton:RID_SCDLG_DELCELL:BTN_CELLSUP";
- Pos = MAP_APPFONT ( 12 , 14 ) ;
- Size = MAP_APPFONT ( 114 , 10 ) ;
- Text [ en-US ] = "Shift cells ~up" ;
- TabStop = TRUE ;
- };
- FixedLine FL_FRAME
- {
- Pos = MAP_APPFONT ( 6 , 3 ) ;
- Size = MAP_APPFONT ( 123 , 8 ) ;
- Text [ en-US ] = "Selection" ;
- };
-};
-
ModalDialog RID_SCDLG_INSCELL
{
OutputSize = TRUE ;
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 04d6eb9..85fcf83 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -267,14 +267,14 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
{
ScRange aRange;
ScDocument* pDoc = GetViewData()->GetDocument();
- sal_Bool bTheFlag=GetViewData()->IsMultiMarked() ||
+ bool bTheFlag=GetViewData()->IsMultiMarked() ||
(GetViewData()->GetSimpleArea(aRange) == SC_MARK_SIMPLE_FILTERED) ||
(pDoc->GetChangeTrack() != NULL);
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
- AbstractScDeleteCellDlg* pDlg = pFact->CreateScDeleteCellDlg( pTabViewShell->GetDialogParent(), RID_SCDLG_DELCELL, bTheFlag );
+ AbstractScDeleteCellDlg* pDlg = pFact->CreateScDeleteCellDlg( pTabViewShell->GetDialogParent(), bTheFlag );
OSL_ENSURE(pDlg, "Dialog create fail!");
if (pDlg->Execute() == RET_OK)
diff --git a/sc/uiconfig/scalc/ui/deletecells.ui b/sc/uiconfig/scalc/ui/deletecells.ui
index 276326f..fbaa5e0 100644
--- a/sc/uiconfig/scalc/ui/deletecells.ui
+++ b/sc/uiconfig/scalc/ui/deletecells.ui
@@ -1,28 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
- <object class="GtkDialog" id="deletecells">
+ <object class="GtkDialog" id="DeleteCellsDialog">
<property name="can_focus">False</property>
- <property name="border_width">5</property>
+ <property name="border_width">6</property>
<property name="title" translatable="yes">Delete Cells</property>
<property name="type_hint">dialog</property>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
- <property name="spacing">2</property>
+ <property name="spacing">12</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="layout_style">start</property>
<child>
- <object class="GtkButton" id="ok1">
+ <object class="GtkButton" id="ok">
<property name="label">gtk-ok</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="can_default">True</property>
<property name="has_default">True</property>
<property name="receives_default">True</property>
- <property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
</object>
<packing>
@@ -32,12 +32,11 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="cancel1">
+ <object class="GtkButton" id="cancel">
<property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
</object>
<packing>
@@ -47,12 +46,11 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="help1">
+ <object class="GtkButton" id="help">
<property name="label">gtk-help</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
<property name="image_position">top</property>
</object>
@@ -80,23 +78,25 @@
<object class="GtkAlignment" id="alignment3">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="top_padding">6</property>
<property name="left_padding">12</property>
<child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
+ <property name="spacing">6</property>
<child>
- <object class="GtkRadioButton" id="radiobutton1">
+ <object class="GtkRadioButton" id="up">
<property name="label" translatable="yes">Shift cells _up</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
+ <property name="group">left</property>
</object>
<packing>
<property name="expand">False</property>
@@ -105,16 +105,15 @@
</packing>
</child>
<child>
- <object class="GtkRadioButton" id="radiobutton2">
+ <object class="GtkRadioButton" id="left">
<property name="label" translatable="yes">Shift cells _left</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
- <property name="active">True</property>
<property name="draw_indicator">True</property>
+ <property name="group">rows</property>
</object>
<packing>
<property name="expand">False</property>
@@ -123,16 +122,15 @@
</packing>
</child>
<child>
- <object class="GtkRadioButton" id="radiobutton3">
+ <object class="GtkRadioButton" id="rows">
<property name="label" translatable="yes">Delete entire _row(s)</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
- <property name="active">True</property>
<property name="draw_indicator">True</property>
+ <property name="group">cols</property>
</object>
<packing>
<property name="expand">False</property>
@@ -141,16 +139,15 @@
</packing>
</child>
<child>
- <object class="GtkRadioButton" id="radiobutton4">
+ <object class="GtkRadioButton" id="cols">
<property name="label" translatable="yes">Delete entire _column(s)</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
- <property name="active">True</property>
<property name="draw_indicator">True</property>
+ <property name="group">up</property>
</object>
<packing>
<property name="expand">False</property>
@@ -163,11 +160,13 @@
</object>
</child>
<child type="label">
- <object class="GtkLabel" id="Selectio">
+ <object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes"><b>Selection</b></property>
- <property name="use_markup">True</property>
+ <property name="label" translatable="yes">Selection</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
</object>
</child>
</object>
@@ -180,9 +179,9 @@
</object>
</child>
<action-widgets>
- <action-widget response="0">ok1</action-widget>
- <action-widget response="0">cancel1</action-widget>
- <action-widget response="0">help1</action-widget>
+ <action-widget response="0">ok</action-widget>
+ <action-widget response="0">cancel</action-widget>
+ <action-widget response="0">help</action-widget>
</action-widgets>
</object>
</interface>
commit eb4786e88a6e79d2c5f7723d93cd547f5994dea2
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Apr 11 14:45:03 2013 +0200
Remove dead code
Change-Id: I090b0b1b10fdfe9d5955fe0137214d8907c3aa0c
diff --git a/unodevtools/Executable_skeletonmaker.mk b/unodevtools/Executable_skeletonmaker.mk
index b39dca0..f021485 100644
--- a/unodevtools/Executable_skeletonmaker.mk
+++ b/unodevtools/Executable_skeletonmaker.mk
@@ -54,7 +54,6 @@ $(eval $(call gb_Executable_use_static_libraries,uno-skeletonmaker,\
$(eval $(call gb_Executable_add_exception_objects,uno-skeletonmaker,\
unodevtools/source/unodevtools/options \
- unodevtools/source/unodevtools/typeblob \
unodevtools/source/skeletonmaker/skeletonmaker \
unodevtools/source/skeletonmaker/skeletoncommon \
unodevtools/source/skeletonmaker/javatypemaker \
diff --git a/unodevtools/source/unodevtools/typeblob.cxx b/unodevtools/source/unodevtools/typeblob.cxx
deleted file mode 100644
index 7f2a6fd..0000000
--- a/unodevtools/source/unodevtools/typeblob.cxx
+++ /dev/null
@@ -1,797 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <string.h>
-
-#include "rtl/alloc.h"
-#include "registry/writer.hxx"
-
-#include "com/sun/star/beans/PropertyAttribute.hpp"
-#include "com/sun/star/container/XHierarchicalNameAccess.hpp"
-#include "com/sun/star/reflection/XPublished.hpp"
-#include "com/sun/star/reflection/XInterfaceTypeDescription2.hpp"
-#include "com/sun/star/reflection/XSingletonTypeDescription2.hpp"
-#include "com/sun/star/reflection/XServiceTypeDescription2.hpp"
-#include "com/sun/star/reflection/XStructTypeDescription.hpp"
-#include "com/sun/star/reflection/XConstantsTypeDescription.hpp"
-#include "com/sun/star/reflection/XConstantTypeDescription.hpp"
-#include "com/sun/star/reflection/XModuleTypeDescription.hpp"
-#include "com/sun/star/reflection/XInterfaceMethodTypeDescription.hpp"
-#include "com/sun/star/reflection/XInterfaceAttributeTypeDescription2.hpp"
-#include "com/sun/star/reflection/XMethodParameter.hpp"
-#include "com/sun/star/reflection/XCompoundTypeDescription.hpp"
-#include "com/sun/star/reflection/XIndirectTypeDescription.hpp"
-#include "com/sun/star/reflection/XEnumTypeDescription.hpp"
-
-#include "codemaker/generatedtypeset.hxx"
-
-using namespace com::sun::star::uno;
-using namespace com::sun::star::beans;
-using namespace com::sun::star::container;
-using namespace com::sun::star::reflection;
-using namespace codemaker;
-
-
-namespace unodevtools {
-
-void writeConstantData(typereg::Writer& rWriter, sal_uInt16 fieldIndex,
- const Reference< XConstantTypeDescription >& xConstant)
-
-{
- RTConstValue constValue;
- OUString uConstTypeName;
- OUString uConstName = xConstant->getName();
- Any aConstantAny = xConstant->getConstantValue();
-
- switch ( aConstantAny.getValueTypeClass() )
- {
- case TypeClass_BOOLEAN:
- {
- uConstTypeName = "boolean";
- constValue.m_type = RT_TYPE_BOOL;
- aConstantAny >>= constValue.m_value.aBool;
- }
- break;
- case TypeClass_BYTE:
- {
- uConstTypeName = "byte";
- constValue.m_type = RT_TYPE_BYTE;
- aConstantAny >>= constValue.m_value.aByte;
- }
- break;
- case TypeClass_SHORT:
- {
- uConstTypeName = "short";
- constValue.m_type = RT_TYPE_INT16;
- aConstantAny >>= constValue.m_value.aShort;
- }
- break;
- case TypeClass_UNSIGNED_SHORT:
- {
- uConstTypeName = "unsigned short";
- constValue.m_type = RT_TYPE_UINT16;
- aConstantAny >>= constValue.m_value.aUShort;
- }
- break;
- case TypeClass_LONG:
- {
- uConstTypeName = "long";
- constValue.m_type = RT_TYPE_INT32;
- aConstantAny >>= constValue.m_value.aLong;
- }
- break;
- case TypeClass_UNSIGNED_LONG:
- {
- uConstTypeName = "unsigned long";
- constValue.m_type = RT_TYPE_UINT32;
- aConstantAny >>= constValue.m_value.aULong;
- }
- break;
- case TypeClass_FLOAT:
- {
- uConstTypeName = "float";
- constValue.m_type = RT_TYPE_FLOAT;
- aConstantAny >>= constValue.m_value.aFloat;
- }
- break;
- case TypeClass_DOUBLE:
- {
- uConstTypeName = "double";
- constValue.m_type = RT_TYPE_DOUBLE;
- aConstantAny >>= constValue.m_value.aDouble;
- }
- break;
- case TypeClass_STRING:
- {
- uConstTypeName = "string";
- constValue.m_type = RT_TYPE_STRING;
- constValue.m_value.aString = ((OUString*)aConstantAny.getValue())->getStr();
- }
- break;
- default:
- OSL_FAIL( "unsupported constant type" );
- break;
- }
-
- rWriter.setFieldData(fieldIndex, OUString(), OUString(), RT_ACCESS_CONST,
- uConstName, uConstTypeName, constValue);
-}
-
-sal_uInt32 getInheritedMemberCount(
- GeneratedTypeSet& checkedTypes,
- Sequence< Reference< XTypeDescription > >& superTypes)
-{
- sal_uInt32 memberCount = 0;
-
- sal_uInt16 count = (sal_uInt16)superTypes.getLength();
- OString name;
- for (sal_uInt16 i=0; i < count; i++) {
- name = OString(OUStringToOString(superTypes[i]->getName(),
- RTL_TEXTENCODING_UTF8));
- if (!checkedTypes.contains(name)) {
- checkedTypes.add(name);
-
- Reference< XInterfaceTypeDescription2 > xIFace(
- superTypes[i], UNO_QUERY);
-
- Sequence< Reference< XTypeDescription> > baseTypes =
- xIFace->getBaseTypes();
- if ( baseTypes.getLength() > 0)
- memberCount += getInheritedMemberCount(checkedTypes, baseTypes);
-
- memberCount += xIFace->getMembers().getLength();
- }
- }
-
- return memberCount;
-}
-
-void writeMethodData( typereg::Writer& rWriter, sal_uInt32 calculatedMemberOffset,
- const Reference< XInterfaceMethodTypeDescription >& xMethod )
-{
- RTMethodMode methodMode = RT_MODE_TWOWAY;
- if ( xMethod->isOneway() )
- methodMode = RT_MODE_ONEWAY;
-
- Sequence< Reference< XMethodParameter > > parameters(xMethod->getParameters());
- Sequence< Reference< XTypeDescription > > exceptions(xMethod->getExceptions());
-
- sal_uInt16 methodIndex = (sal_uInt16)(xMethod->getPosition()
- - calculatedMemberOffset);
- sal_uInt16 paramCount = (sal_uInt16)parameters.getLength();
- sal_uInt16 exceptionCount = (sal_uInt16)exceptions.getLength();
-
- rWriter.setMethodData(methodIndex, OUString(), methodMode,
- xMethod->getMemberName(),
- xMethod->getReturnType()->getName().replace('.', '/'),
- paramCount, exceptionCount);
-
- RTParamMode paramMode = RT_PARAM_IN;
- sal_uInt16 i;
-
- for ( i=0; i < paramCount; i++) {
- Reference< XMethodParameter > xParam = parameters[i];
- if ( xParam->isIn() && xParam->isOut())
- paramMode = RT_PARAM_INOUT;
- else if ( xParam->isIn() )
- paramMode = RT_PARAM_IN;
- else if ( xParam->isOut() )
- paramMode = RT_PARAM_OUT;
-
- rWriter.setMethodParameterData(methodIndex,
- (sal_uInt16)xParam->getPosition(),
- paramMode, xParam->getName(),
- xParam->getType()->
- getName().replace('.', '/'));
- }
-
- for (i=0; i < exceptionCount; i++) {
- rWriter.setMethodExceptionTypeName(
- methodIndex, i, exceptions[i]->getName().replace('.', '/'));
- }
-}
-
-void writeAttributeMethodData(
- typereg::Writer& rWriter, sal_uInt16& methodindex, RTMethodMode methodmode,
- const Reference<XInterfaceAttributeTypeDescription2>& xAttr)
-{
- Sequence<Reference<XCompoundTypeDescription> > seqExcp;
- if (methodmode == RT_MODE_ATTRIBUTE_GET)
- seqExcp = xAttr->getGetExceptions();
- else
- seqExcp = xAttr->getSetExceptions();
-
- if (seqExcp.getLength() > 0) {
- rWriter.setMethodData(methodindex, OUString(), methodmode,
- xAttr->getMemberName(),
- OUString("void"),
- 0, (sal_uInt16)seqExcp.getLength());
-
- for (sal_Int32 i=0; i < seqExcp.getLength(); i++) {
- rWriter.setMethodExceptionTypeName(
- methodindex, (sal_uInt16)i,
- seqExcp[i]->getName().replace('.', '/'));
- }
- ++methodindex;
- }
-}
-
-RTFieldAccess checkParameterizedTypeFlag(const Sequence< OUString >& typeParams,
- const OUString & memberType)
-{
- for (sal_uInt16 i=0; i < typeParams.getLength(); i++) {
- if (typeParams[i].equals(memberType))
- return RT_ACCESS_PARAMETERIZED_TYPE;
- }
-
- return RT_ACCESS_READWRITE;
-}
-
-RTFieldAccess checkPropertyFlags(short flags) {
- RTFieldAccess propertyFlags=RT_ACCESS_INVALID;
- switch(flags) {
- case PropertyAttribute::MAYBEVOID:
- propertyFlags |= RT_ACCESS_MAYBEVOID;
- case PropertyAttribute::BOUND:
- propertyFlags |= RT_ACCESS_BOUND;
- case PropertyAttribute::CONSTRAINED:
- propertyFlags |= RT_ACCESS_CONSTRAINED;
- case PropertyAttribute::TRANSIENT:
- propertyFlags |= RT_ACCESS_TRANSIENT;
- case PropertyAttribute::READONLY :
- propertyFlags |= RT_ACCESS_READONLY;
- case PropertyAttribute::MAYBEAMBIGUOUS:
- propertyFlags |= RT_ACCESS_MAYBEAMBIGUOUS;
- case PropertyAttribute::MAYBEDEFAULT:
- propertyFlags |= RT_ACCESS_MAYBEDEFAULT;
- case PropertyAttribute::REMOVABLE:
- propertyFlags |= RT_ACCESS_REMOVEABLE;
- case PropertyAttribute::OPTIONAL:
- propertyFlags |= RT_ACCESS_OPTIONAL;
- }
- return propertyFlags;
-}
-
-void* getTypeBlob(Reference< XHierarchicalNameAccess > xTDmgr,
- const OString& typeName, sal_uInt32* blobsize)
-{
- if ( typeName.isEmpty() )
- return NULL;
-
- OUString uTypeName(OStringToOUString(typeName, RTL_TEXTENCODING_UTF8)
- .replace('/', '.'));
-
- Any aTypeAny( xTDmgr->getByHierarchicalName( uTypeName ) );
-
- if ( !aTypeAny.hasValue() )
- return NULL;
-
- Reference< XTypeDescription > xType;
- aTypeAny >>= xType;
-
- if ( !xType.is() )
- return NULL;
-
- Reference< XPublished > xPublished(xType, UNO_QUERY);
- void* pBlob = NULL;
- switch (xType->getTypeClass())
- {
- case TypeClass_CONSTANTS:
- {
- Reference< XConstantsTypeDescription > xCFace(xType, UNO_QUERY);
-
- if ( !xCFace.is() )
- return NULL;
-
- Sequence< Reference< XConstantTypeDescription > > constTypes(
- xCFace->getConstants());
- sal_uInt16 constCount = (sal_uInt16)constTypes.getLength();
-
- typereg::Writer writer(TYPEREG_VERSION_1, OUString(), OUString(),
- RT_TYPE_CONSTANTS, xPublished->isPublished(),
- uTypeName.replace('.', '/'),
- 0, constCount, 0, 0);
-
- for (sal_uInt16 i=0; i < constCount; i++)
- writeConstantData(writer, i, constTypes[i]);
-
- const void* p = writer.getBlob(blobsize);
- pBlob = (sal_uInt8*)rtl_allocateMemory(*blobsize);
- memcpy(pBlob, p, *blobsize);
- }
- break;
- case TypeClass_MODULE:
- {
- Reference< XModuleTypeDescription > xMFace(xType, UNO_QUERY);
-
- if ( !xMFace.is() )
- return NULL;
-
- Sequence< Reference< XTypeDescription > > memberTypes(
- xMFace->getMembers());
-
- sal_uInt16 memberCount = (sal_uInt16)memberTypes.getLength();
- sal_uInt16 constCount = 0;
- sal_Int16 i;
-
- for ( i=0; i < memberCount; i++) {
- if ( TypeClass_CONSTANT == memberTypes[i]->getTypeClass() )
- constCount++;
- }
-
- typereg::Writer writer(TYPEREG_VERSION_1, OUString(), OUString(),
- RT_TYPE_MODULE, xPublished->isPublished(),
- uTypeName.replace('.', '/'),
- 0, constCount, 0, 0);
-
- if ( 0 < constCount ) {
- Reference< XConstantTypeDescription > xConst;
- sal_uInt16 fieldIndex = 0;
- for (i=0; i < memberCount; i++) {
- if ( TypeClass_CONSTANT == memberTypes[i]->getTypeClass() ) {
- xConst = Reference< XConstantTypeDescription >(
- memberTypes[i], UNO_QUERY);
-
- writeConstantData(writer, ++fieldIndex, xConst);
- }
- }
- }
-
- const void* p = writer.getBlob(blobsize);
- pBlob = (sal_uInt8*)rtl_allocateMemory(*blobsize);
- memcpy(pBlob, p, *blobsize);
- }
- break;
- case TypeClass_INTERFACE:
- {
- Reference< XInterfaceTypeDescription2 > xIFace(xType, UNO_QUERY);
-
- if ( !xIFace.is() )
- return NULL;
-
- Reference< XInterfaceAttributeTypeDescription2 > xAttr;
- Reference< XInterfaceMethodTypeDescription > xMethod;
- Sequence< Reference< XInterfaceMemberTypeDescription > > memberTypes(
- xIFace->getMembers());
- Sequence< Reference< XTypeDescription > > baseTypes =
- xIFace->getBaseTypes();
- Sequence< Reference< XTypeDescription > > optBaseTypes =
- xIFace->getOptionalBaseTypes();
-
- sal_uInt16 baseCount = (sal_uInt16)baseTypes.getLength();
- sal_uInt16 optBaseCount = (sal_uInt16)optBaseTypes.getLength();
- sal_uInt16 memberCount = (sal_uInt16)memberTypes.getLength();
- sal_uInt16 attrCount = 0, attrmethods = 0;
- sal_uInt16 inheritedMemberCount = 0;
- sal_uInt16 i;
-
- for (i=0; i < memberCount; i++) {
- xAttr = Reference< XInterfaceAttributeTypeDescription2 >(
- memberTypes[i], UNO_QUERY);
- if ( xAttr.is() ) {
- attrCount++;
-
- if (xAttr->getGetExceptions().getLength() > 0)
- attrmethods++;
-
- if (xAttr->getSetExceptions().getLength() > 0)
- attrmethods++;
- }
- }
-
- // check inherited members count
- if (baseCount > 0) {
- GeneratedTypeSet checkedTypes;
- inheritedMemberCount = (sal_uInt16)getInheritedMemberCount(
- checkedTypes, baseTypes );
- }
-
- typereg::Writer writer(TYPEREG_VERSION_1, OUString(), OUString(),
- RT_TYPE_INTERFACE, xPublished->isPublished(),
- uTypeName.replace('.', '/'),
- baseCount, attrCount, memberCount-attrCount+attrmethods,
- (sal_uInt16)optBaseTypes.getLength());
-
- // set super types
- for (i=0; i < baseCount; i++) {
- writer.setSuperTypeName(i, baseTypes[i]->
- getName().replace('.', '/'));
- }
-
- // set optional super types
- RTReferenceType referenceType = RT_REF_SUPPORTS;
- RTFieldAccess fieldAccess = RT_ACCESS_OPTIONAL;
- for (i=0; i < optBaseCount; i++) {
- writer.setReferenceData(i, OUString(), referenceType,
- fieldAccess, optBaseTypes[i]->
- getName().replace('.', '/'));
- }
-
- fieldAccess = RT_ACCESS_READWRITE;
- // reset attrCount, used for method index calculation
- attrCount = 0;
- attrmethods = 0;
- for (i=0; i < memberCount; i++) {
- xAttr = Reference< XInterfaceAttributeTypeDescription2 >(
- memberTypes[i], UNO_QUERY);
- if ( xAttr.is() ) {
- ++attrCount;
- if (xAttr->isReadOnly())
- fieldAccess = RT_ACCESS_READONLY;
- else
- fieldAccess = RT_ACCESS_READWRITE;
-
- if (xAttr->isBound())
- fieldAccess |= RT_ACCESS_BOUND;
-
- writer.setFieldData((sal_uInt16)memberTypes[i]->getPosition()
- - inheritedMemberCount,
- OUString(), OUString(), fieldAccess,
- memberTypes[i]->getMemberName(),
- xAttr->getType()->getName().replace('.','/'),
- RTConstValue());
-
- writeAttributeMethodData(writer, attrmethods,
- RT_MODE_ATTRIBUTE_GET, xAttr);
- if (!xAttr->isReadOnly()) {
- writeAttributeMethodData(writer, attrmethods,
- RT_MODE_ATTRIBUTE_SET, xAttr);
- }
-
- continue;
- }
-
- xMethod = Reference< XInterfaceMethodTypeDescription >(
- memberTypes[i], UNO_QUERY);
- if ( xMethod.is() ) {
- writeMethodData(writer, attrCount+inheritedMemberCount-attrmethods,
- xMethod);
- }
- }
-
- const void* p = writer.getBlob(blobsize);
- pBlob = (sal_uInt8*)rtl_allocateMemory(*blobsize);
- memcpy(pBlob, p, *blobsize);
- }
- break;
- case TypeClass_STRUCT:
- {
- Reference< XStructTypeDescription > xStruct(xType, UNO_QUERY);
-
- if ( !xStruct.is() )
- return NULL;
-
- if ( xStruct->getTypeArguments().getLength() > 0)
- return NULL;
-
-
- Sequence< OUString > typeParams( xStruct->getTypeParameters());
- Sequence< OUString > memberNames( xStruct->getMemberNames());
- Sequence< Reference< XTypeDescription > > memberTypes(
- xStruct->getMemberTypes());
- sal_uInt16 memberCount = (sal_uInt16)memberNames.getLength();
-
- OUString uSuperType;
- sal_uInt16 superCount=0;
- if ( typeParams.getLength() == 0) {
- Reference< XTypeDescription > xSuperType = xStruct->getBaseType();
- if ( xSuperType.is() ) {
- ++superCount;
- uSuperType = xSuperType->getName().replace('.','/');
- }
- }
- typereg::Writer writer(TYPEREG_VERSION_1, OUString(), OUString(),
- RT_TYPE_STRUCT, xPublished->isPublished(),
- uTypeName.replace('.', '/'),
- superCount, memberCount, 0,
- (sal_uInt16)typeParams.getLength());
-
- // set super type
- if (superCount > 0) {
- writer.setSuperTypeName(0, uSuperType);
- }
-
- sal_uInt16 i=0;
- for (i=0; i < memberCount; i++) {
- RTFieldAccess fieldAccess = RT_ACCESS_READWRITE;
- if (typeParams.getLength() > 0)
- fieldAccess |= checkParameterizedTypeFlag(
- typeParams, memberTypes[i]->getName());
-
- writer.setFieldData(i, OUString(), OUString(), fieldAccess,
- memberNames[i],
- memberTypes[i]->getName().replace('.', '/'),
- RTConstValue());
- }
-
- for (i=0; i < typeParams.getLength(); i++) {
- writer.setReferenceData(i, OUString(), RT_REF_TYPE_PARAMETER,
- RT_ACCESS_INVALID, typeParams[i]);
- }
-
- const void* p = writer.getBlob(blobsize);
- pBlob = (sal_uInt8*)rtl_allocateMemory(*blobsize);
- memcpy(pBlob, p, *blobsize);
- }
- break;
- case TypeClass_EXCEPTION:
- {
- Reference< XCompoundTypeDescription > xComp(xType, UNO_QUERY);
-
- if ( !xComp.is() )
- return NULL;
-
- Sequence< OUString > memberNames( xComp->getMemberNames());
- Sequence< Reference< XTypeDescription > > memberTypes(
- xComp->getMemberTypes());
- sal_uInt16 memberCount = (sal_uInt16)memberNames.getLength();
-
- OUString uSuperType;
- sal_uInt16 superCount=0;
- Reference< XTypeDescription > xSuperType = xComp->getBaseType();
- if ( xSuperType.is() ) {
- ++superCount;
- uSuperType = xSuperType->getName().replace('.','/');
- }
-
- typereg::Writer writer(TYPEREG_VERSION_1, OUString(), OUString(),
- RT_TYPE_EXCEPTION, xPublished->isPublished(),
- uTypeName.replace('.', '/'),
- superCount, memberCount, 0, 0);
-
- // set super type
- if (superCount > 0) {
- writer.setSuperTypeName(0, uSuperType);
- }
-
- for (sal_Int16 i=0; i < memberCount; i++) {
- writer.setFieldData(i, OUString(), OUString(), RT_ACCESS_READWRITE,
- memberNames[i],
- memberTypes[i]->getName().replace('.', '/'),
- RTConstValue());
- }
-
- const void* p = writer.getBlob(blobsize);
- pBlob = (sal_uInt8*)rtl_allocateMemory(*blobsize);
- memcpy(pBlob, p, *blobsize);
- }
- break;
- case TypeClass_ENUM:
- {
- Reference< XEnumTypeDescription > xEnum(xType, UNO_QUERY);
-
- if ( !xEnum.is() )
- return NULL;
-
- Sequence< OUString > enumNames( xEnum->getEnumNames());
- Sequence< sal_Int32 > enumValues( xEnum->getEnumValues());
- sal_uInt16 enumCount = (sal_uInt16)enumNames.getLength();
-
- typereg::Writer writer(TYPEREG_VERSION_1, OUString(), OUString(),
- RT_TYPE_ENUM, xPublished->isPublished(),
- uTypeName.replace('.', '/'),
- 0, enumCount, 0, 0);
-
- RTConstValue constValue;
- for (sal_Int16 i=0; i < enumCount; i++) {
- constValue.m_type = RT_TYPE_INT32;
- constValue.m_value.aLong = enumValues[i];
-
- writer.setFieldData(i, OUString(), OUString(),
- RT_ACCESS_CONST, enumNames[i],
- OUString(), constValue);
- }
-
- const void* p = writer.getBlob(blobsize);
- pBlob = (sal_uInt8*)rtl_allocateMemory(*blobsize);
- memcpy(pBlob, p, *blobsize);
- }
- break;
- case TypeClass_TYPEDEF:
- {
- Reference< XIndirectTypeDescription > xTD(xType, UNO_QUERY);
-
- if ( !xTD.is() )
- return NULL;
-
- typereg::Writer writer(TYPEREG_VERSION_1, OUString(), OUString(),
- RT_TYPE_TYPEDEF, xPublished->isPublished(),
- uTypeName.replace('.', '/'),
- 1, 0, 0, 0);
-
- writer.setSuperTypeName(0, xTD->getReferencedType()
- ->getName().replace('.','/'));
-
- const void* p = writer.getBlob(blobsize);
- pBlob = (sal_uInt8*)rtl_allocateMemory(*blobsize);
- memcpy(pBlob, p, *blobsize);
- }
- break;
- case TypeClass_SERVICE:
- {
- Reference< XServiceTypeDescription2 > xService(xType, UNO_QUERY);
-
- if ( !xService.is() )
- return NULL;
-
- Sequence<Reference<XServiceConstructorDescription> > constructors(
- xService->getConstructors());
- Sequence<Reference<XPropertyTypeDescription> > properties;
- Sequence<Reference<XServiceTypeDescription> > mandatoryServices;
- Sequence<Reference<XServiceTypeDescription> > optionalServices;
- Sequence<Reference<XInterfaceTypeDescription> > mandatoryInterfaces;
- Sequence<Reference<XInterfaceTypeDescription> > optionalInterfaces;
- sal_uInt16 methodCount = (sal_uInt16)constructors.getLength();
- sal_uInt16 referenceCount = 0;
- sal_uInt16 propertyCount = 0;
-
- if ( !xService->isSingleInterfaceBased() ) {
- mandatoryServices = xService->getMandatoryServices();
- optionalServices = xService->getOptionalServices();
- mandatoryInterfaces = xService->getMandatoryInterfaces();
- optionalInterfaces = xService->getOptionalInterfaces();
- properties = xService->getProperties();
- referenceCount = (sal_uInt16)(
- mandatoryServices.getLength()+
- optionalServices.getLength()+
- mandatoryInterfaces.getLength()+
- optionalInterfaces.getLength());
- propertyCount = (sal_uInt16)properties.getLength();
- }
-
- typereg::Writer writer(TYPEREG_VERSION_1, OUString(), OUString(),
- RT_TYPE_SERVICE, xPublished->isPublished(),
- uTypeName.replace('.', '/'),
- (xService->isSingleInterfaceBased() ? 1 : 0),
- propertyCount, methodCount, referenceCount);
-
- sal_uInt16 i=0;
- if ( xService->isSingleInterfaceBased() ) {
- writer.setSuperTypeName(0, xService->getInterface()
- ->getName().replace('.','/'));
-
- sal_uInt16 j=0;
- for ( i=0; i<methodCount; i++ ) {
- Reference<XServiceConstructorDescription> xConstructor(
- constructors[i], UNO_QUERY);
- Sequence<Reference<XParameter> > parameters;
- Sequence<Reference<XCompoundTypeDescription> > exceptions;
- sal_uInt16 parameterCount=0;
- sal_uInt16 exceptionCount=0;
- if ( !xConstructor->isDefaultConstructor() ) {
- parameters = xConstructor->getParameters();
- parameterCount = (sal_uInt16)parameters.getLength();
- }
-
- writer.setMethodData(i, OUString(), RT_MODE_TWOWAY,
- xConstructor->getName(),
- OUString("void"),
- parameterCount, exceptionCount);
-
- if ( !xConstructor->isDefaultConstructor() ) {
- for ( j=0; j<parameterCount; j++ ) {
- Reference<XParameter> xParam(parameters[j], UNO_QUERY);
- RTParamMode paramMode = RT_PARAM_IN;
- if (xParam->isRestParameter())
- paramMode = RT_PARAM_REST;
-
- writer.setMethodParameterData(
- i, (sal_uInt16)xParam->getPosition(),
- paramMode, xParam->getName(),
- xParam->getType()->getName().replace('.', '/'));
- }
-
- for (j=0; j<exceptionCount; j++) {
- Reference<XCompoundTypeDescription> xExcp(
- exceptions[j], UNO_QUERY);
-
- writer.setMethodExceptionTypeName(
- i, j, xExcp->getName().replace('.', '/'));
- }
- }
- }
- } else
- {
- for (i=0; i<propertyCount; i++) {
- Reference<XPropertyTypeDescription> xProp(
- properties[i], UNO_QUERY);
-
- RTFieldAccess propertyFlags = checkPropertyFlags(
- xProp->getPropertyFlags());
-
- writer.setFieldData(i, OUString(), OUString(),
- propertyFlags,
- xProp->getName().copy(xProp->getName().lastIndexOf('.')+1),
- xProp->getPropertyTypeDescription()
- ->getName().replace('.', '/'),
- RTConstValue());
- }
-
- sal_uInt16 refIndex = 0;
- sal_uInt16 length = (sal_uInt16)mandatoryServices.getLength();
- for (i=0; i < length; i++) {
- writer.setReferenceData(refIndex++, OUString(),
- RT_REF_EXPORTS, RT_ACCESS_INVALID,
- mandatoryServices[i]->getName()
- .replace('.', '/'));
- }
- length = (sal_uInt16)optionalServices.getLength();
- for (i=0; i < length; i++) {
- writer.setReferenceData(refIndex++, OUString(),
- RT_REF_EXPORTS, RT_ACCESS_OPTIONAL,
- optionalServices[i]->getName()
- .replace('.', '/'));
- }
- length = (sal_uInt16)mandatoryInterfaces.getLength();
- for (i=0; i < length; i++) {
- writer.setReferenceData(refIndex++, OUString(),
- RT_REF_SUPPORTS, RT_ACCESS_INVALID,
- mandatoryInterfaces[i]->getName()
- .replace('.', '/'));
- }
- length = (sal_uInt16)optionalInterfaces.getLength();
- for (i=0; i < length; i++) {
- writer.setReferenceData(refIndex++, OUString(),
- RT_REF_SUPPORTS, RT_ACCESS_OPTIONAL,
- optionalInterfaces[i]->getName()
- .replace('.', '/'));
- }
- }
-
- const void* p = writer.getBlob(blobsize);
- pBlob = (sal_uInt8*)rtl_allocateMemory(*blobsize);
- memcpy(pBlob, p, *blobsize);
- }
- break;
- case TypeClass_SINGLETON:
- {
- Reference<XSingletonTypeDescription2> xSingleton(xType, UNO_QUERY);
-
- if ( !xSingleton.is() )
- return NULL;
-
- typereg::Writer writer(TYPEREG_VERSION_1, OUString(), OUString(),
- RT_TYPE_SINGLETON, xPublished->isPublished(),
- uTypeName.replace('.', '/'),
- 1, 0, 0, 0);
-
- if (xSingleton->isInterfaceBased()) {
- writer.setSuperTypeName(0, xSingleton->getInterface()
- ->getName().replace('.','/'));
- } else {
- writer.setSuperTypeName(0, xSingleton->getService()
- ->getName().replace('.','/'));
- }
-
- const void* p = writer.getBlob(blobsize);
- pBlob = (sal_uInt8*)rtl_allocateMemory(*blobsize);
- memcpy(pBlob, p, *blobsize);
- }
- break;
- default:
- OSL_FAIL( "unsupported type" );
- break;
- }
-
- return pBlob;
-}
-
-} // end of namespace unodevtools
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list