summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sfx2/Library_sfx.mk1
-rw-r--r--sfx2/source/dialog/inputdlg.cxx58
-rw-r--r--sfx2/source/dialog/inputdlg.hrc7
-rw-r--r--sfx2/source/dialog/inputdlg.src10
-rw-r--r--sfx2/source/doc/templatedlg.cxx5
-rw-r--r--sfx2/source/doc/templatedlg.hrc1
-rw-r--r--sfx2/source/doc/templatedlg.src5
-rw-r--r--sfx2/source/inc/inputdlg.hxx37
8 files changed, 124 insertions, 0 deletions
diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk
index 0bff14e0b5cc..da801593f6d7 100644
--- a/sfx2/Library_sfx.mk
+++ b/sfx2/Library_sfx.mk
@@ -164,6 +164,7 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\
sfx2/source/dialog/filedlghelper \
sfx2/source/dialog/filtergrouping \
sfx2/source/dialog/itemconnect \
+ sfx2/source/dialog/inputdlg \
sfx2/source/dialog/mailmodel \
sfx2/source/dialog/mgetempl \
sfx2/source/dialog/navigat \
diff --git a/sfx2/source/dialog/inputdlg.cxx b/sfx2/source/dialog/inputdlg.cxx
new file mode 100644
index 000000000000..41d5d4f48635
--- /dev/null
+++ b/sfx2/source/dialog/inputdlg.cxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Copyright 2012 LibreOffice contributors.
+ *
+ * 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/.
+ */
+
+#include "inputdlg.hxx"
+
+#include <vcl/button.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/fixed.hxx>
+
+#define LABEL_TEXT_SPACE 10
+#define DIALOG_BORDER 10
+#define MAX_FOLDER_NAME_LENGTH 20
+
+InputDialog::InputDialog (const rtl::OUString &rLabelText, Window *pParent)
+ : ModalDialog(pParent),
+ mpEntry(new Edit(this)),
+ mpLabel(new FixedText(this))
+{
+ SetStyle(GetStyle() | WB_CENTER | WB_VCENTER);
+
+ Point aPos(DIALOG_BORDER,DIALOG_BORDER);
+
+ Size aTextSize = mpLabel->CalcMinimumTextSize(mpLabel,100);
+ Size aEntrySize = mpEntry->CalcSize(MAX_FOLDER_NAME_LENGTH);
+
+ aTextSize.setWidth(aEntrySize.getHeight());
+
+ mpLabel->SetPosPixel(Point(DIALOG_BORDER,DIALOG_BORDER));
+ mpLabel->SetSizePixel(aTextSize);
+ mpLabel->SetText(String("Enter name"));
+
+ aPos.setX(DIALOG_BORDER + aTextSize.getWidth() + LABEL_TEXT_SPACE + DIALOG_BORDER);
+
+ mpEntry->SetPosPixel(aPos);
+ mpEntry->SetSizePixel(aEntrySize);
+
+ // Set windows correct size
+ SetSizePixel(Size(aTextSize.getWidth() + aEntrySize.getWidth() + 2*DIALOG_BORDER,
+ aTextSize.getHeight()+2*DIALOG_BORDER));
+
+ mpEntry->Show();
+ mpLabel->Show();
+}
+
+rtl::OUString InputDialog::getEntryText () const
+{
+ return mpEntry->GetText();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+
+
diff --git a/sfx2/source/dialog/inputdlg.hrc b/sfx2/source/dialog/inputdlg.hrc
new file mode 100644
index 000000000000..b9fdf70c2edd
--- /dev/null
+++ b/sfx2/source/dialog/inputdlg.hrc
@@ -0,0 +1,7 @@
+/*
+ * Copyright 2012 LibreOffice contributors.
+ *
+ * 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/.
+ */
diff --git a/sfx2/source/dialog/inputdlg.src b/sfx2/source/dialog/inputdlg.src
new file mode 100644
index 000000000000..cece9f887f8c
--- /dev/null
+++ b/sfx2/source/dialog/inputdlg.src
@@ -0,0 +1,10 @@
+/*
+ * Copyright 2012 LibreOffice contributors.
+ *
+ * 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/.
+ */
+
+#include "inputdlg.hrc"
+
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 9b819baeb7fb..357c247484d3 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -9,6 +9,8 @@
#include "templatedlg.hxx"
+#include "inputdlg.hxx"
+
#include <comphelper/processfactory.hxx>
#include <sfx2/filedlghelper.hxx>
#include <sfx2/sfxresid.hxx>
@@ -459,6 +461,9 @@ IMPL_LINK(SfxTemplateManagerDlg, MoveMenuSelectHdl, Menu*, pMenu)
if (nMenuId == MNI_MOVE_NEW)
{
+ InputDialog dlg(SfxResId(STR_INPUT_NEW).toString(),this);
+
+ int ret = dlg.Execute();
}
else if (nMenuId == MNI_MOVE_DELETE)
{
diff --git a/sfx2/source/doc/templatedlg.hrc b/sfx2/source/doc/templatedlg.hrc
index b24d844ccdd4..8a46b1113a14 100644
--- a/sfx2/source/doc/templatedlg.hrc
+++ b/sfx2/source/doc/templatedlg.hrc
@@ -51,6 +51,7 @@
#define STR_MOVE_NEW 268
#define STR_MOVE_DELETE 270
+#define STR_INPUT_NEW 271
#define IMG_ONLINE_REPOSITORY 100
#define IMG_CREATE_TEXT 300
diff --git a/sfx2/source/doc/templatedlg.src b/sfx2/source/doc/templatedlg.src
index 27fdfbbc647c..f0ac3322d345 100644
--- a/sfx2/source/doc/templatedlg.src
+++ b/sfx2/source/doc/templatedlg.src
@@ -45,6 +45,11 @@ String STR_MOVE_DELETE
Text [ en-US ] = "No folder";
};
+String STR_INPUT_NEW
+{
+ Text [ en-US ] = "Enter folder name:";
+};
+
ModalDialog DLG_TEMPLATE_MANAGER
{
HelpId = CMD_SID_TEMPLATE_MANAGER;
diff --git a/sfx2/source/inc/inputdlg.hxx b/sfx2/source/inc/inputdlg.hxx
new file mode 100644
index 000000000000..7e09c9fee550
--- /dev/null
+++ b/sfx2/source/inc/inputdlg.hxx
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Copyright 2012 LibreOffice contributors.
+ *
+ * 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/.
+ */
+
+#ifndef INPUTDLG_HXX
+#define INPUTDLG_HXX
+
+#include <vcl/dialog.hxx>
+
+class Edit;
+class FixedText;
+class PushButton;
+
+class InputDialog : public ModalDialog
+{
+public:
+
+ InputDialog (const rtl::OUString &labelText, Window *pParent = NULL);
+
+ rtl::OUString getEntryText () const;
+
+private:
+
+ Edit *mpEntry;
+ FixedText *mpLabel;
+ PushButton *mpOK;
+ PushButton *mpCancel;
+};
+
+#endif // INPUTDLG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */