[Libreoffice-commits] .: Branch 'feature/calc-xml-source' - sc/inc sc/Library_sc.mk sc/Library_scui.mk sc/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Oct 10 17:45:39 PDT 2012
sc/Library_sc.mk | 1
sc/Library_scui.mk | 1
sc/inc/scabstdlg.hxx | 7 ------
sc/source/ui/app/scdll.cxx | 1
sc/source/ui/attrdlg/scdlgfact.cxx | 8 ------
sc/source/ui/attrdlg/scdlgfact.hxx | 7 ------
sc/source/ui/inc/reffact.hxx | 1
sc/source/ui/inc/xmlsourcedlg.hrc | 8 ++++++
sc/source/ui/inc/xmlsourcedlg.hxx | 22 ++++++++++++++++---
sc/source/ui/src/xmlsourcedlg.src | 37 +++++++++++++++++++++++++++++++-
sc/source/ui/view/cellsh1.cxx | 12 ++++------
sc/source/ui/view/reffact.cxx | 4 +++
sc/source/ui/view/tabvwsh.cxx | 1
sc/source/ui/view/tabvwshc.cxx | 7 ++++++
sc/source/ui/xmlsource/xmlsourcedlg.cxx | 35 +++++++++++++++++++++++++++---
15 files changed, 114 insertions(+), 38 deletions(-)
New commits:
commit f56d9195b960e7fdbcc968b19f77bf3c912f6f8a
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Wed Oct 10 20:45:55 2012 -0400
Turned the xml source dialog into a reference dialog.
Change-Id: Ifb3ebd3c0166343f42dd53bcee83c6b31c84f081
diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index 9bc420f..089e7f2 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -567,6 +567,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
sc/source/ui/view/viewfunc \
sc/source/ui/view/viewutil \
sc/source/ui/view/waitoff \
+ sc/source/ui/xmlsource/xmlsourcedlg \
))
$(eval $(call gb_SdiTarget_SdiTarget,sc/sdi/scslots,sc/sdi/scalc))
diff --git a/sc/Library_scui.mk b/sc/Library_scui.mk
index c78faca..0cc4099 100644
--- a/sc/Library_scui.mk
+++ b/sc/Library_scui.mk
@@ -116,7 +116,6 @@ $(eval $(call gb_Library_add_exception_objects,scui,\
sc/source/ui/pagedlg/tphf \
sc/source/ui/pagedlg/tptable \
sc/source/ui/styleui/styledlg \
- sc/source/ui/xmlsource/xmlsourcedlg \
))
ifeq ($(OS),WNT)
diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx
index 5c04cec..22261ce 100644
--- a/sc/inc/scabstdlg.hxx
+++ b/sc/inc/scabstdlg.hxx
@@ -334,11 +334,6 @@ public:
virtual bool IsDateConversionSet() const = 0;
};
-class AbstractScXMLSourceDlg : public VclAbstractDialog
-{
-public:
-};
-
//-------Scabstract fractory ---------------------------
class ScAbstractDialogFactory
{
@@ -537,8 +532,6 @@ public:
virtual SfxAbstractTabDialog * CreateScSortDlg( Window* pParent, //add for ScSortDlg
const SfxItemSet* pArgSet,int nId ) = 0;
- virtual AbstractScXMLSourceDlg* CreateScXMLSourceDlg(Window* pParent, ScDocument* pDoc, int nId) = 0;
-
// for tabpage
virtual CreateTabPage GetTabPageCreatorFunc( sal_uInt16 nId ) = 0;
virtual GetTabPageRanges GetTabPageRangesFunc( sal_uInt16 nId ) = 0;
diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx
index 651b46a..22e704b 100644
--- a/sc/source/ui/app/scdll.cxx
+++ b/sc/source/ui/app/scdll.cxx
@@ -257,6 +257,7 @@ void ScDLL::Init()
sal::static_int_cast<sal_uInt16>(ScTabViewShell::GetInterfaceId()), pMod);
ScSolverDlgWrapper ::RegisterChildWindow(false, pMod);
ScOptSolverDlgWrapper ::RegisterChildWindow(false, pMod);
+ ScXMLSourceDlgWrapper ::RegisterChildWindow(false, pMod);
ScNameDlgWrapper ::RegisterChildWindow(false, pMod);
ScNameDefDlgWrapper ::RegisterChildWindow(false, pMod);
ScPivotLayoutWrapper ::RegisterChildWindow(false, pMod);
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index d437807..2bca1ff 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -124,7 +124,6 @@ IMPL_ABSTDLG_BASE(AbstractScStringInputDlg_Impl);
IMPL_ABSTDLG_BASE(AbstractScTabBgColorDlg_Impl);
IMPL_ABSTDLG_BASE(AbstractScImportOptionsDlg_Impl);
IMPL_ABSTDLG_BASE(AbstractScTextImportOptionsDlg_Impl);
-IMPL_ABSTDLG_BASE(AbstractScXMLSourceDlg_Impl);
IMPL_ABSTDLG_BASE(AbstractTabDialog_Impl);
// AbstractTabDialog_Impl begin
@@ -1596,13 +1595,6 @@ SfxAbstractTabDialog * ScAbstractDialogFactory_Impl::CreateScSortDlg( Window*
return 0;
}
-AbstractScXMLSourceDlg* ScAbstractDialogFactory_Impl::CreateScXMLSourceDlg(Window* pParent, ScDocument* pDoc, int nId)
-{
- ScXMLSourceDlg* pDlg = (nId == RID_SCDLG_XML_SOURCE) ? new ScXMLSourceDlg(pParent, pDoc) : NULL;
-
- return pDlg ? new AbstractScXMLSourceDlg_Impl(pDlg) : NULL;
-}
-
#undef SfxTabDialog
#undef AbstractTabDialog_Impl
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx
index c250582..22d9643 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -390,11 +390,6 @@ class AbstractScTextImportOptionsDlg_Impl : public AbstractScTextImportOptionsDl
virtual bool IsDateConversionSet() const;
};
-class AbstractScXMLSourceDlg_Impl : public AbstractScXMLSourceDlg
-{
- DECL_ABSTDLG_BASE(AbstractScXMLSourceDlg_Impl, ScXMLSourceDlg)
-};
-
//add for ScAttrDlg , ScHFEditDlg, ScStyleDlg, ScSubTotalDlg, ScCharDlg, ScParagraphDlg, ScValidationDlg, ScSortDlg
class AbstractTabDialog_Impl : public SfxAbstractTabDialog
{
@@ -610,8 +605,6 @@ public:
virtual SfxAbstractTabDialog * CreateScSortDlg( Window* pParent, //add for ScSortDlg
const SfxItemSet* pArgSet,int nId );
- virtual AbstractScXMLSourceDlg* CreateScXMLSourceDlg(Window* pParent, ScDocument* pDoc, int nId);
-
// For TabPage
virtual CreateTabPage GetTabPageCreatorFunc( sal_uInt16 nId );
diff --git a/sc/source/ui/inc/reffact.hxx b/sc/source/ui/inc/reffact.hxx
index e7d728f..19a08c5 100644
--- a/sc/source/ui/inc/reffact.hxx
+++ b/sc/source/ui/inc/reffact.hxx
@@ -47,6 +47,7 @@ DECL_WRAPPER_WITHID(ScNameDlgWrapper)
DECL_WRAPPER_WITHID(ScNameDefDlgWrapper)
DECL_WRAPPER_WITHID(ScSolverDlgWrapper)
DECL_WRAPPER_WITHID(ScOptSolverDlgWrapper)
+DECL_WRAPPER_WITHID(ScXMLSourceDlgWrapper)
DECL_WRAPPER_WITHID(ScPivotLayoutWrapper)
DECL_WRAPPER_WITHID(ScTabOpDlgWrapper)
DECL_WRAPPER_WITHID(ScFilterDlgWrapper)
diff --git a/sc/source/ui/inc/xmlsourcedlg.hrc b/sc/source/ui/inc/xmlsourcedlg.hrc
index ec10aff..67cf9b8 100644
--- a/sc/source/ui/inc/xmlsourcedlg.hrc
+++ b/sc/source/ui/inc/xmlsourcedlg.hrc
@@ -17,11 +17,17 @@
#define FT_SOURCE_FILE 12
#define FL_MAP_XML_TO_DOCUMENT 20
-#define LB_SOURCE_TREE 21
+#define FT_MAPPED_CELL_TITLE 21
+#define ED_MAPPED_CELL 22
+#define BTN_MAPPED_CELL 23
+#define LB_SOURCE_TREE 24
#define IMG_ELEMENT_DEFAULT 50
#define IMG_ELEMENT_REPEAT 51
#define IMG_ELEMENT_ATTRIBUTE 52
#define IMG_FILE_OPEN 53
+#define STR_CELL_LINK 70
+#define STR_RANGE_LINK 71
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
diff --git a/sc/source/ui/inc/xmlsourcedlg.hxx b/sc/source/ui/inc/xmlsourcedlg.hxx
index 39bfa6b..ee8225c 100644
--- a/sc/source/ui/inc/xmlsourcedlg.hxx
+++ b/sc/source/ui/inc/xmlsourcedlg.hxx
@@ -11,15 +11,16 @@
#define __SC_XMLSOURCEDLG_HXX__
#include "vcl/button.hxx"
-#include "vcl/dialog.hxx"
#include "vcl/fixed.hxx"
#include "svtools/svtreebx.hxx"
#include "expftext.hxx"
+#include "anyrefdg.hxx"
#include <boost/scoped_ptr.hpp>
class ScDocument;
+class ScRange;
class ScXMLSourceTree : public SvTreeListBox
{
@@ -27,7 +28,7 @@ public:
ScXMLSourceTree(Window* pParent, const ResId& rResId);
};
-class ScXMLSourceDlg : public ModalDialog
+class ScXMLSourceDlg : public ScAnyRefDlg
{
FixedLine maFlSourceFile;
ImageButton maBtnSelectSource;
@@ -35,6 +36,10 @@ class ScXMLSourceDlg : public ModalDialog
FixedLine maFtMapXmlDoc;
+ FixedText maFtMappedCellTitle;
+ formula::RefEdit maEdit;
+ formula::RefButton maBtnRb;
+
ScXMLSourceTree maLbTree;
CancelButton maBtnCancel;
@@ -44,12 +49,23 @@ class ScXMLSourceDlg : public ModalDialog
Image maImgElemRepeat;
Image maImgElemAttribute;
+ rtl::OUString maStrCellLink;
+ rtl::OUString maStrRangeLink;
+
ScDocument* mpDoc;
+ bool mbRefMode;
+
public:
- ScXMLSourceDlg(Window* pParent, ScDocument* pDoc);
+ ScXMLSourceDlg(
+ SfxBindings* pB, SfxChildWindow* pCW, Window* pParent, ScDocument* pDoc);
virtual ~ScXMLSourceDlg();
+ virtual sal_Bool IsRefInputMode() const;
+ virtual void SetReference(const ScRange& rRange, ScDocument* pDoc);
+ virtual void SetActive();
+ virtual sal_Bool Close();
+
private:
void SelectSourceFile();
diff --git a/sc/source/ui/src/xmlsourcedlg.src b/sc/source/ui/src/xmlsourcedlg.src
index 8a7b13a..d4ef5ce 100644
--- a/sc/source/ui/src/xmlsourcedlg.src
+++ b/sc/source/ui/src/xmlsourcedlg.src
@@ -8,7 +8,7 @@
#include "xmlsourcedlg.hrc"
-ModalDialog RID_SCDLG_XML_SOURCE
+ModelessDialog RID_SCDLG_XML_SOURCE
{
HelpID = "sc:ModalDialog:RID_SCDLG_XML_SOURCE";
Text [ en-US ] = "XML Source" ;
@@ -48,6 +48,31 @@ ModalDialog RID_SCDLG_XML_SOURCE
Text [ en-US ] = "Map to document";
};
+ FixedText FT_MAPPED_CELL_TITLE
+ {
+ Pos = MAP_APPFONT( 12, 50 );
+ Size = MAP_APPFONT ( 100 , 8 ) ;
+
+ Text [ en-US ] = "";
+ };
+
+ Edit ED_MAPPED_CELL
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 63 ) ;
+ Size = MAP_APPFONT ( 69 , 12 ) ;
+ TabStop = TRUE ;
+ };
+
+
+ ImageButton BTN_MAPPED_CELL
+ {
+ Pos = MAP_APPFONT ( 83 , 62 ) ;
+ Size = MAP_APPFONT ( 13 , 15 ) ;
+ TabStop = FALSE ;
+ QuickHelpText [ en-US ] = "Shrink" ;
+ };
+
Control LB_SOURCE_TREE
{
Border = TRUE ;
@@ -85,5 +110,15 @@ ModalDialog RID_SCDLG_XML_SOURCE
Pos = MAP_APPFONT ( 194 , 181 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
};
+
+ String STR_CELL_LINK
+ {
+ Text [ en-US ] = "Link to cell";
+ };
+
+ String STR_RANGE_LINK
+ {
+ Text [ en-US ] = "Link to range";
+ };
};
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 4a3c6c8..832a794 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -2449,14 +2449,12 @@ void ScCellShell::ExecuteXMLSourceDialog()
if (!pTabViewShell)
return;
- boost::scoped_ptr<AbstractScXMLSourceDlg> pDlg(
- pFact->CreateScXMLSourceDlg(
- pTabViewShell->GetDialogParent(), GetViewData()->GetDocument(), RID_SCDLG_XML_SOURCE));
-
- if (!pDlg)
- return;
+ ScModule* pScMod = SC_MOD();
- pDlg->Execute();
+ sal_uInt16 nId = ScXMLSourceDlgWrapper::GetChildWindowId();
+ SfxViewFrame* pViewFrame = pTabViewShell->GetViewFrame();
+ SfxChildWindow* pWnd = pViewFrame->GetChildWindow(nId);
+ pScMod->SetRefDialog(nId, pWnd ? false : true);
}
void ScCellShell::ExecuteSubtotals(SfxRequest& rReq)
diff --git a/sc/source/ui/view/reffact.cxx b/sc/source/ui/view/reffact.cxx
index 746d7b2..a7cebc4 100644
--- a/sc/source/ui/view/reffact.cxx
+++ b/sc/source/ui/view/reffact.cxx
@@ -46,6 +46,7 @@ SFX_IMPL_MODELESSDIALOG_WITHID(ScNameDlgWrapper, FID_DEFINE_NAME )
SFX_IMPL_MODELESSDIALOG_WITHID(ScNameDefDlgWrapper, FID_ADD_NAME )
SFX_IMPL_MODELESSDIALOG_WITHID(ScSolverDlgWrapper, SID_OPENDLG_SOLVE )
SFX_IMPL_MODELESSDIALOG_WITHID(ScOptSolverDlgWrapper, SID_OPENDLG_OPTSOLVER )
+SFX_IMPL_MODELESSDIALOG_WITHID(ScXMLSourceDlgWrapper, SID_MANAGE_XML_SOURCE)
SFX_IMPL_MODELESSDIALOG_WITHID(ScPivotLayoutWrapper, SID_OPENDLG_PIVOTTABLE )
SFX_IMPL_MODELESSDIALOG_WITHID(ScTabOpDlgWrapper, SID_OPENDLG_TABOP )
SFX_IMPL_MODELESSDIALOG_WITHID(ScFilterDlgWrapper, SID_FILTER )
@@ -59,6 +60,7 @@ SFX_IMPL_MODELESSDIALOG_WITHID(ScAcceptChgDlgWrapper, FID_CHG_ACCEPT )
SFX_IMPL_MODELESSDIALOG_WITHID(ScHighlightChgDlgWrapper, FID_CHG_SHOW )
SFX_IMPL_MODELESSDIALOG_WITHID(ScSimpleRefDlgWrapper, WID_SIMPLE_REF )
SFX_IMPL_CHILDWINDOW_WITHID(ScValidityRefChildWin, SID_VALIDITY_REFERENCE)
+
SfxChildWinInfo ScValidityRefChildWin::GetInfo() const
{
SfxChildWinInfo anInfo = SfxChildWindow::GetInfo();
@@ -127,6 +129,8 @@ IMPL_CHILD_CTOR( ScSolverDlgWrapper, SID_OPENDLG_SOLVE )
IMPL_CHILD_CTOR( ScOptSolverDlgWrapper, SID_OPENDLG_OPTSOLVER )
+IMPL_CHILD_CTOR(ScXMLSourceDlgWrapper, SID_MANAGE_XML_SOURCE)
+
//-------------------------------------------------------------------------
// ScPivotLayoutWrapper
//-------------------------------------------------------------------------
diff --git a/sc/source/ui/view/tabvwsh.cxx b/sc/source/ui/view/tabvwsh.cxx
index 6c976cb..79ed564 100644
--- a/sc/source/ui/view/tabvwsh.cxx
+++ b/sc/source/ui/view/tabvwsh.cxx
@@ -65,6 +65,7 @@ SFX_IMPL_INTERFACE(ScTabViewShell,SfxViewShell,ScResId(SCSTR_TABVIEWSHELL))
SFX_CHILDWINDOW_REGISTRATION(ScNameDefDlgWrapper::GetChildWindowId());
SFX_CHILDWINDOW_REGISTRATION(ScSolverDlgWrapper::GetChildWindowId());
SFX_CHILDWINDOW_REGISTRATION(ScOptSolverDlgWrapper::GetChildWindowId());
+ SFX_CHILDWINDOW_REGISTRATION(ScXMLSourceDlgWrapper::GetChildWindowId());
SFX_CHILDWINDOW_REGISTRATION(ScPivotLayoutWrapper::GetChildWindowId());
SFX_CHILDWINDOW_REGISTRATION(ScTabOpDlgWrapper::GetChildWindowId());
SFX_CHILDWINDOW_REGISTRATION(ScFilterDlgWrapper::GetChildWindowId());
diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx
index a92fca9..29ed690 100644
--- a/sc/source/ui/view/tabvwshc.cxx
+++ b/sc/source/ui/view/tabvwshc.cxx
@@ -63,6 +63,7 @@
#include "dpobject.hxx"
#include "markdata.hxx"
#include "reffact.hxx"
+#include "xmlsourcedlg.hxx"
//------------------------------------------------------------------
@@ -353,6 +354,12 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog(
}
break;
+ case SID_MANAGE_XML_SOURCE:
+ {
+ pResult = new ScXMLSourceDlg(pB, pCW, pParent, pDoc);
+ }
+ break;
+
case FID_CHG_SHOW:
{
// Dialog schaut selber, was in der Zelle steht
diff --git a/sc/source/ui/xmlsource/xmlsourcedlg.cxx b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
index 2a94a9b..37e6c72 100644
--- a/sc/source/ui/xmlsource/xmlsourcedlg.cxx
+++ b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
@@ -14,6 +14,7 @@
#include "document.hxx"
#include "orcusfilters.hxx"
#include "filter.hxx"
+#include "reffact.hxx"
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
@@ -25,30 +26,58 @@ using namespace com::sun::star;
ScXMLSourceTree::ScXMLSourceTree(Window* pParent, const ResId& rResId) :
SvTreeListBox(pParent, rResId) {}
-ScXMLSourceDlg::ScXMLSourceDlg(Window* pParent, ScDocument* pDoc) :
- ModalDialog(pParent, ScResId(RID_SCDLG_XML_SOURCE)),
+ScXMLSourceDlg::ScXMLSourceDlg(
+ SfxBindings* pB, SfxChildWindow* pCW, Window* pParent, ScDocument* pDoc) :
+ ScAnyRefDlg(pB, pCW, pParent, RID_SCDLG_XML_SOURCE),
maFlSourceFile(this, ScResId(FL_SOURCE_FILE)),
maBtnSelectSource(this, ScResId(BTN_SELECT_SOURCE_FILE)),
maFtSourceFile(this, ScResId(FT_SOURCE_FILE)),
maFtMapXmlDoc(this, ScResId(FL_MAP_XML_TO_DOCUMENT)),
+ maFtMappedCellTitle(this, ScResId(FT_MAPPED_CELL_TITLE)),
+ maEdit(this, ScResId(ED_MAPPED_CELL)),
+ maBtnRb(this, ScResId(BTN_MAPPED_CELL)),
maLbTree(this, ScResId(LB_SOURCE_TREE)),
maBtnCancel(this, ScResId(BTN_CANCEL)),
maImgFileOpen(ScResId(IMG_FILE_OPEN)),
maImgElemDefault(ScResId(IMG_ELEMENT_DEFAULT)),
maImgElemRepeat(ScResId(IMG_ELEMENT_REPEAT)),
maImgElemAttribute(ScResId(IMG_ELEMENT_ATTRIBUTE)),
- mpDoc(pDoc)
+ maStrCellLink(ScResId(STR_CELL_LINK).toString()),
+ maStrRangeLink(ScResId(STR_RANGE_LINK).toString()),
+ mpDoc(pDoc),
+ mbRefMode(false)
{
maBtnSelectSource.SetModeImage(maImgFileOpen);
FreeResource();
maBtnSelectSource.SetClickHdl(LINK(this, ScXMLSourceDlg, BtnPressedHdl));
+
+ maFtMappedCellTitle.SetText(maStrCellLink);
}
ScXMLSourceDlg::~ScXMLSourceDlg()
{
}
+sal_Bool ScXMLSourceDlg::IsRefInputMode() const
+{
+ return mbRefMode;
+}
+
+void ScXMLSourceDlg::SetReference(const ScRange& rRange, ScDocument* pDoc)
+{
+}
+
+void ScXMLSourceDlg::SetActive()
+{
+ GrabFocus();
+}
+
+sal_Bool ScXMLSourceDlg::Close()
+{
+ return DoClose(ScXMLSourceDlgWrapper::GetChildWindowId());
+}
+
void ScXMLSourceDlg::SelectSourceFile()
{
uno::Reference<lang::XMultiServiceFactory> xServiceMgr = mpDoc->GetServiceManager();
More information about the Libreoffice-commits
mailing list